in reply to a lil help on file extension
It's overkill for this simple example, but it could be useful if you want to break up and test pieces of the file name and path in a portable way.use strict; use File::Basename; my $file_name = $ARGV[0]; my @suffixlist = ("\.html", "\.htm"); my ($name, $path, $suffix) = fileparse($file_name,@suffixlist); if ($suffix ne "") { print "file name $file_name matched\n"; }
|
|---|