in reply to Interpretting character combinations as special characters.
my %mapping = ( '\t' => "\t", '\n' => "\n", '\)' => ')'. '\( => '(', ); my $re = join '|', map quotemeta, keys %mapping; $str =~ s/($re)/$mapping{$1}/g;
This has the advantage of not relying on perl's escaping rules (and thus gives you fine control over what's happening), but has the disadvantage that you have to list all replacements.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Interpretting character combinations as special characters.
by JavaFan (Canon) on Dec 10, 2009 at 13:32 UTC |