in reply to Using File::Basename and $ARGV[]
I think what you want is simply:
use strict; use warnings; use File::Basename; $org_fn = $ARGV[1]; my $base = basename $org_fn; print "Basename is $base\n";
Note that File::Basename is a great way to get the name of the script itself, too.
I usually do this:
my $iam = basename $0; my $syntax = " syntax: $iam ... ";
and then don't have to worry about changing the program name; the syntax message stays correct.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using File::Basename and $ARGV[]
by chinamox (Scribe) on Oct 23, 2006 at 15:23 UTC |