in reply to Removing underscores.

$txt = "This_is_a_song_.mp3"; substr($txt, rindex($txt, '_'), 1) = ''; print $txt;
You could also do it with a greedy regex, as stated above:
$txt = "This_is_a_song_.mp3"; $txt =~ s/(.*)_/$1/; print $txt;