Can some one tell me way this does not work.
I believe I can, yes. :)
if (@ARGV[0] = "-q"){print "it worked\n";} else {print "it did not work\n";}
Okay, one issue at a time. First @ARGV[0] should be $ARGV[0]. When we're talking about a scalar value, we use the scalar symbol, even if it's in an array. Your version creates an array slice, which we don't want here.
That leads us to another problem. Warnings should have told you this, which means you probably don't have them turned on. You should add the lines use strict; and use warnings; to the top of your script, so Perl will hold you to the rules of good programming. It really helps.
Your actual bug is the =. = means assign this value to, so you're just overwriting $ARGV[0] here, which is why it always works. == is closer, but still wrong. That asks if they are the same number, but we're interested in strings here. eq is the operator for comparing string equality.
Let's see what that gives us:
if ($ARGV[0] eq '-q' { print "it worked\n"; } else { print "it did not work\n"; }
That should fix you up. Good luck.
James
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]