This is a very common mistake, so don't feel bad.
The "=" operator assigns the value on the right to the variable on the left.
The "==" operator checks two numeric values for comparison, returning true
if they match
The "eq" operator checks two string values for comparison, returning true if
they match
So you need to change your code to:
If(@ARGV[0] eq "-q"){
print "It worked\n";
}else{
print "It did not work\n";
}
-----Original Message-----
From: Thomas Browner [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 04, 2003 2:31 PM
To: [EMAIL PROTECTED]
Subject: help if than else statement
Can some one tell me way this does not work.
if (@ARGV[0] = "-q"){print "it worked\n";}
else {print "it did not work\n";}
if I use a -w instead of -q it still prints it worked.
Thomas Browner
Digidyne, Inc
Technical Engineer
(251)479-1637
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]