Mnemonic: heI<x>adecimal.
-=head4 Examples
+=head4 Examples (assuming an ASCII platform)
$str = "Perl";
$str =~ /\x50/; # Match, "\x50" is "P".
escape sequences, e.g., C<\033>, or hexadecimal escape sequences,
e.g., C<\x1B>:
- "1000\t2000" =~ m(0\t2) # matches
- "cat" =~ /\143\x61\x74/ # matches, but a weird way to spell cat
+ "1000\t2000" =~ m(0\t2) # matches
+ "cat" =~ /\143\x61\x74/ # matches in ASCII, but a weird way to spell cat
Regexes are treated mostly as double quoted strings, so variable
substitution works:
"1000\t2000" =~ m(0\t2) # matches
"1000\n2000" =~ /0\n20/ # matches
"1000\t2000" =~ /\000\t2/ # doesn't match, "0" ne "\000"
- "cat" =~ /\143\x61\x74/ # matches, but a weird way to spell cat
+ "cat" =~ /\143\x61\x74/ # matches in ASCII, but a weird way to spell cat
If you've been around Perl a while, all this talk of escape sequences
may seem familiar. Similar escape sequences are used in double-quoted