in reply to Getting a base name

Iron wisely suggests File::Basename. Here's how it goes,

use File::Basename; my $filename = "../../path/to/test.txt"; my $basename = basename( $filename, '.txt', '.dat'); print $basename, $/; __END__ test
If you omit the extension list arguments, or if $filename's extension is not in the list, basename() will return the basename with extension.

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