Looks like you're trying to get the filename component of a file path. For this particular task, a more portable solution is to use the basename function from File::Basename, which is comes with the standard Perl distribution.
blokhead
Comment on Re: split string and always get last word