Argument "B" isn't numeric in numeric bitwise xor (^) at 1.pl line 10. #### use feature qw( bitwise ); #### my $stoval = "$pckval" ^. 0x80; #### $stoval = "B" ^. 0x80; # $stoval = [s28] - Expecting [194] $stohex = "0x" . (unpack 'H16', "s28"); # $stohex = [0x733238] - Expecting [0xc2] #### my $stoval = $pckval ^ "\x80"; # or my $stoval = $pckval ^ chr 0x80; # or my $stoval = $pckval ^ pack 'C', 0x80; # ...