use File::Spec qw( ); my $file = ( File::Spec->splitpath($path) )[2];