Hi,

I understood that @ARGV is used to hold the command
line parameters given to a perl script.  But, when I
tried to access them, its empty.

The following code piece assumes two command line
options be given, the first one being the -f switch
and the second one being the file name itself.

myscript.pl -f test.txt

So, $0 will be myscript.pl and I want to really test
whether the user specifed all the arguments and the
arguments are correct.

So, I've to check

if($#ARGV < 2)
{
   print $USAGE;
}

BTW, what is this $USAGE.  I saw it in some books and
just copied here.  Please let me know how to use
$USAGE also.

The following is the pseudo code I want to use by
using @ARGV.

if($ARGV[0] !~ /-f/) print "Wrong switch";
if($ARGV[1]) !~ //) print "Empty file name not 
allowed";

But, since @ARGV is empty, I am unable to validate the
command line arguments.

Please throw me some ideas on how to access the
command line arguments and what's going wrong here.

PS: I am using Perl5.6.1.exe on Win 98.

Thanks in advance,
Sudarsan



__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to