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

See File::Basename respectively File::Spec->splitpath.