Mega Code Archive

 
Categories / Perl / Language Basics
 

Check a specific bit

$flag = 2030136; if ($flag & 1 << 3) {     print "The third bit is set."; }  else {     print "The third bit is not set."; }