http://www.perlmonks.org?node_id=80210


in reply to How do I split a string containing path+filename

For maximum portability, use File::Basename, a standard CPAN module:

use File::Basename; use strict; # get full path in $path my $filename = basename($path);