my $s = "foo \x03 bar \x05 baz"; printf "detected strange char: 0x%x\n", ord for $s =~ /[^\x20-\x7e]/g; __END__ detected strange char: 0x3 detected strange char: 0x5