in reply to Get last occurence of a character in a string

Although, as mentioned, File::Basename or File::Spec is a better way to do this, it is easy to do what you want. Either
s/.*\\(?=[^\\]$)//;
or
reverse; $_ = reverse substr($_, 0, index($_, '\\'));
will work (assuming that you have a copy of the string of interest in $_, and don't mind that copy being overwritten).

UPDATE: Oops, the rindex function, mentioned at Re: Index of the last occurence of a character inside a string, is much better than this reverse-based solution.