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 chanting in the Monastery: (5)
As of 2014-12-22 10:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (116 votes), past polls