in reply to How can I get the file name
Or if you're expecting to port the code, File::Spec is the way to gomy $value = "/home/image/office.iso"; my($fullname, $filename) = $value =~ m< / ( ( [^/]+ ) \. .* ) \z >x; print "fullname - $fullname\nfilename - $filename\n"; __output__ fullname - office.iso filename - office
See. perlre and File::Spec::Functions for more info.use File::Spec::Functions 'splitpath'; my $value = "/home/image/office.iso"; my($fullname,$filename) = (splitpath $value)[-1] =~ m< ( ([^\.]+) \. .*) >x; print "fullname - $fullname\nfilename - $filename\n"; __output__ fullname - office.iso filename - office
_________
broquaint
|
|---|