in reply to Isolating a file name
To get rid of the file extension, use fileparse (from the same module). You can use the command perldoc File::Basename for more details.use File::Basename; my $s = "/home/virtual/path/to/www/some/directory/filename.txt"; my $fname = basename($s);
Update: As helphand points out, you can also supply the extension (or a list of extensions) to strip, to basename. Of course, you could also just use a regex to strip any extension afterwards, such as:
$fname =~ s/\.[^\.]*$//;
|
|---|