my $char = chr(226); my $pat = quotemeta($char); # Create pattern that matches string s/$pat/'/ig;
my $char = chr(226); s/\Q$char\E/'/ig; # Alternate way of calling quotemeta
s/\xE2/'/ig; # 0xE2 == 226
In reply to Re: Using 'ord' in a regular expression for substitution
by ikegami
in thread Using 'ord' in a regular expression for substitution
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |