Check a specific bit : Bitwise Operator « Language Basics « Perl
- Perl
- Language Basics
- Bitwise Operator
Check a specific bit
$flag = 2030136;
if ($flag & 1 << 3) {
print "The third bit is set.";
}
else {
print "The third bit is not set.";
}
Related examples in the same category