well, actually you cant *just* use || instead of or, seeing || binds
tighter...

just try running this bit of code, and you'll see what i mean:

if($c || $d = 2) { print "foo" }

thus, if you use || and you wish to compare like you do, you *have* to use
parens

correct code would therefor be
if($a || ($b = 2) ) { print "foo" }

alltho what jeff said is very true: use OR for strings... just like you should
use EQ rather then ==

Regards,

Jos Boumans

<snip>

Jeff Pinyan wrote:

> On May 17, Doug Johnson said:
>
> >my $x = "return";
> >
> >if (($x = "a") || ($x = "test" ) || ($x = "return" ) || ($x = "x-retun"))
> >   {
> >   print("bunch of foo....);
> >   }
>

<snip>


>
> (Yes, you can use parens if you want, and || instead of 'or', but the
> point is, using = is ASSIGNING to $x.  And using == on strings is a
> no-no.  You need to use 'eq'.)
>

Reply via email to