Re: Problem accessing the command line arguments

2002-05-02 Thread John W. Krahn
Chris Ball wrote: > > > "Sailaja" == Sailaja Gudipati <[EMAIL PROTECTED]> writes: > > Sailaja> if($ARGV[0] !~ /-f/) print "Wrong switch"; > > This looks fine, though you need braces around the print statement. > Also note that 'foo-fbar' matches this regexp. I'd use: > > if ($ARGV

Re: Problem accessing the command line arguments

2002-05-02 Thread Chris Ball
> "Sailaja" == Sailaja Gudipati <[EMAIL PROTECTED]> writes: Sailaja> myscript.pl -f test.txt Sailaja> if($#ARGV < 2) { print $USAGE; } $# returns the _last element index_ in the array. As I pointed out in my last mail, array indexes are zero-indexed, not one-indexed. Your if condi

Problem accessing the command line arguments

2002-05-02 Thread Sailaja Gudipati
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. mysc