Why am I not surprised that the PERL part could be solved with bash in the same space. Why are you so eager to use lang on top of lang, in such simple cases?
/podcast/with/nasty'--c h a r$/and/stuff/track1.mp3track1.mp3
$ path="/podcast/with/nasty'--c h a r$/and/stuff/track1.mp3"
$ echo "${path##*/}"
track1.mp3
$ basename "${path}"
track1.mp3
$ echo "${path}" | awk -F/ '{print $NF}'
track1.mp3 $ i="/podcast/with/nasty'--c h a r$/and/stuff/track1.mp3"
$ echo "${i##*/}"
track1.mp3
[Edit: 'thezilch beat me too it by a couple of minutes] $ function remove_longest_matching_prefix () { echo "${1##$2}"; }
$ remove_longest_matching_prefix "$i" '*/'
track1.mp3
awk -F/ accepts stream as in perl example echo “${uglypath:t}”