#!perl -w
#< test or/and bit flags
use strict;
use warnings;
my $F_HADMEM = 8;
my $flag = 1;
my $msg = '';
$msg = ($flag & $F_HADMEM) ? "Got HADMEM" : "No HADMEM";
print "Value of flag = $flag ($msg)\n";
$flag |= $F_HADMEM;  # ADD the BIT to flag
$msg = ($flag & $F_HADMEM) ? "Got HADMEM" : "No HADMEM";
print "Value of flag = $flag ($msg)\n";
$flag &= ~$F_HADMEM; # REMOVE the BIT from the flag
$msg = ($flag & $F_HADMEM) ? "Got HADMEM" : "No HADMEM";
print "Value of flag = $flag ($msg)\n";
