in reply to Warnings and bitwise and
Do you mean you want the ASCII code of $a? If so, use ord and some extra brackets:
my $a = "a"; if ( (ord($a) & 1) << 7) {print "happy\n"}
Update:
if ( ord($a) & (1 << 7) ) {print "happy\n"}
seems to make more sense
|
|---|