Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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

by philipbailey (Deacon)
on Nov 11, 2014 at 21:38 UTC ( #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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1106894]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2022-01-19 14:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (55 votes). Check out past polls.

    Notices?