Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: bitwise AND against a variable containing Fnctl constants not returning desired results

by RichardK (Priest)
on Jun 05, 2014 at 22:32 UTC ( #1088940=note: print w/ replies, xml ) Need Help??


in reply to bitwise AND against a variable containing Fnctl constants not returning desired results

bitwise & has a lower precedence that == , so perl thinks your code is this

return unless $ds[2] & ( $mask == $mask)

try adding more brackets to get it do do what you want.

return unless  ($ds[2] & $mask) == $mask;

There is a table of operators in precedence order in perlop


Comment on Re: bitwise AND against a variable containing Fnctl constants not returning desired results
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (10)
As of 2014-10-24 09:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (131 votes), past polls