# Assumes ASCII. $string1 = "@@@@@"; $string2 = "ABCDE"; $xored = $string1 ^ $string2; print($xored eq "\x01\x02\x03\x04\x05" ? "ok\n" : "not ok\n");