in reply to Capturing Base Name of a File With or Without Path

Like this?
use File::Basename; my $name = basename($file_with_path2,'.out','.some_other_ext'); print "$name\n";
This also works with file name comes without path. Read the documentation, there are many things you can do with this very useful module.

Regards,
Edward

Replies are listed 'Best First'.
Re^2: Capturing Base Name of a File With or Without Path
by chargrill (Parson) on Jan 26, 2006 at 07:12 UTC
    Yeah, that would do it too.

    *sigh*
    $/ = q#(\w)# ; sub sig { print scalar reverse join ' ', @_ } + sig map { s$\$/\$/$\$2\$1$g && $_ } split( ' ', ",erckha rlPe erthnoa stJu +" );