Re: help if than else statement

2003-09-04 Thread Randal L. Schwartz
> "Tim" == Tim Johnson <[EMAIL PROTECTED]> writes: Tim> So you need to change your code to: Tim> If(@ARGV[0] eq "-q"){ Tim>print "It worked\n"; Tim> }else{ Tim>print "It did not work\n"; Tim> } And you really need to change @ARGV[0] to $ARGV[0], or else the "don't use an array slice

Re: help if than else statement

2003-09-04 Thread James Edward Gray II
On Thursday, September 4, 2003, at 04:31 PM, Thomas Browner wrote: 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 talki

RE: help if than else statement

2003-09-04 Thread West, William M
>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 oh dear!! i'd forgotten that detail. sometimes i still get myself with this one. willy -- To unsubscribe, e-mai

RE: help if than else statement

2003-09-04 Thread West, William M
> >Can some one tell me way this does not work. > > > >if (@ARGV[0] = "-q"){print "it worked\n";} try (@ARGV[0] == "-q") ^^ this got me too- the "==" compares values while "=" assignes the right side value to lef

RE: help if than else statement

2003-09-04 Thread Tim Johnson
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

Re: help if than else statement

2003-09-04 Thread Matt Matijevich
try this: if (@ARGV[0] == "-q"){print "it worked\n";} else {print "it did not work\n";} -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]