in reply to bitwise operators

It is doing bitwise operators, just on the bits in your characters. This is probably not what you want. Look into using pack and unpack:

my $p1 = pack( 'H*', "24" ); # hex 24 my $p2 = pack( 'H*', "04" ); # hex 4 my $p3 = $p1 & $p2; print unpack( 'H*', $p3 ), "\n"; # prints 04 $p1 = pack( 'H*', "2f" ); $p2 = pack( 'H*', "14" ); $p3 = $p1 | $p2; print unpack( 'H*', $p3 ), "\n"; # prints 3f