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 strin
hone: +357-25-845384(O)
-Original Message-
From: John W. Krahn [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 26, 2002 6:12 PM
To: [EMAIL PROTECTED]
Subject: Re: checking parameters ...
Admin-Stress wrote:
>
> I wrote a simple script like this :
>
> #!/usr/bin/perl
&
On Thu, Sep 26, 2002 at 07:30:37AM -0700, Admin-Stress wrote:
> I can use "if (scalar(@ARGV) < 3) {...}" but that not the case.
If the user executes the program like so:
program.pl foo bar
@ARGV will have 2 elements.
If the user executes the program like so:
program.pl "" "" ""
@ARGV
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
change && to ||
> -Original Message-
> From: Admin-Stress [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 26, 2002 10:31 AM
> To: Perl beginners
> Subject: checking parameters ...
>
>
> I wrote a simple script like this :
>
> #!/usr/bin/pe
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