On Fri, 27 Sep 2002, Anurag K. Singh wrote:

> use or instead of && like :
> 
> if (($ARGV[0] eq "") or ($ARGV[1] eq "") or ($ARGV[2] eq "")) {
>     print "You must give me 3 parameters\n";
>         exit
> }
> 
> It works for me.


1) If I were to use your program how would I pass an empty string as an 
   argument. For e.g. let's call your program anurag.pl
   If I make a call like anurag.pl "arg1" "" "arg3" it will print the 
   error and exit.
2) Exit with a non-zero value on an error condition. By default exit 
   exits with 0 (perldoc -f exit)
3) If you had turned warnings on in your program this will throw out a 
   message like this "Use of uninitialized value...." if $ARGV[0] or
   $ARGV[1] or $ARGV[2] were not defined (note: not the same as "").

The right way to do this is 
if (@ARGV != 3) {
    print "Usage: <progname> <arg1> <arg2> <arg3>\n";
    exit 1;
}


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

Reply via email to