use File::Spec::Functions qw(splitpath); my (undef,undef,$file)=splitpath($path); #### use File::Spec; my ($vol,$path,$file)=File::Spec->splitpath($path);