Admin-Stress wrote:
> 
> I wrote a simple script like this :
> 
> #!/usr/bin/perl
> 
> if (($ARGV[0] eq "") && ($ARGV[1] eq "") && ($ARGV[2] eg "")) {
>    print "You must give me 3 parameters\n";
>    exit;
> }
> 
> Then, I tested like with 1 .. OR 2 ... OR 3 parameters, it did not print the text 
>"You must...".
> 
> Why this happened? How to detect "null" parameters? is "" equal to "null"?
> 
> I can use "if (scalar(@ARGV) < 3) {...}" but that not the case.


if ( @ARGV != 3 ) {
   print "You must give me 3 parameters\n";
   exit 1;
}

OR:

unless ( @ARGV == 3 ) {
   print "You must give me 3 parameters\n";
   exit 1;
}




John
-- 
use Perl;
program
fulfillment

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

Reply via email to