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. Thanks Anurag Kumar Singh AMDOCS DEVELOPMENT LTD. Limassol , Cyprus. Phone: +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 > > 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]
------------------------------------------------------------------------------------- The information contained in this message is proprietary of Amdocs, protected from disclosure, and may be privileged. The information is intended to be conveyed only to the designated recipient(s) of the message. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, use, distribution or copying of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. -------------------------------------------------------------------------------------
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]