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