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