in reply to Getting a base name
Iron wisely suggests File::Basename. Here's how it goes,
If you omit the extension list arguments, or if $filename's extension is not in the list, basename() will return the basename with extension.use File::Basename; my $filename = "../../path/to/test.txt"; my $basename = basename( $filename, '.txt', '.dat'); print $basename, $/; __END__ test
F::B also offers the functions dirname(), which extracts just the directory part, and fileparse(), which returns a list of ($basename, $dirname, $extension)
After Compline,
Zaxo
|
|---|