in reply to Interpretting character combinations as special characters.
my $string = 'This is\na special\tstring'; my %replace = map { $_ => eval "\\$_" } (qw( n r t )); $string =~ s/\\(.)/exists $replace{$1} ? $replace{$1} : $1/ge; print $string;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Interpretting character combinations as special characters.
by afoken (Chancellor) on Dec 10, 2009 at 20:08 UTC | |
by Corion (Patriarch) on Dec 10, 2009 at 21:31 UTC |