Bitwise And

Bitwise And

Binary "&" returns its operands ANDed together bit by bit. Although no warning is currently raised, the result is not well defined when this operation is performed on operands that aren't either numbers (see Integer Arithmetic) nor bitstrings (see Bitwise String Operators).

Note that "&" has lower priority than relational operators, so for example the parentheses are essential in a test like

print "Even\n" if ($x & 1) == 0;

If the experimental "bitwise" feature is enabled via use feature 'bitwise' , then this operator always treats its operand as numbers. This feature produces a warning unless you also use no warnings 'experimental::bitwise' .

doc_perl
2016-12-06 03:18:24
Comments
Leave a Comment

Please login to continue.