Been using a rooted s5 on L for a while. The easyest way is to use Odin to flash a recovery and have the recovery auto root it.
https://twrp.me/devices/samsunggalaxys5qualcomm.html
Edited for link