Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: my 'if' condition doesn't work, why?

by philipbailey (Curate)
on Nov 11, 2014 at 21:38 UTC ( [id://1106894] : note . print w/replies, xml ) Need Help??


in reply to my 'if' condition doesn't work, why?

The expression (40||47||76) "short-circuits" and evaluates to 40. Scalar $n is then only compared to 40.

Edit: the solution is as toolic suggests, though I tend to use the low-precedence or operator by default (rather than the high precedence one, ||), as it more often does what I expect.