in reply to Replacing non ascii in string
Hello IanD, and welcome to the Monastery!
Try this:
14:33 >perl -wE "my $s = 'Australia’s ‘Powder Capital’'; $s =~ tr/‘’/' +/; say $s;" Australia's 'Powder Capital' 14:33 >
See tr{}{} in Quote and Quote like Operators.
Update: Likewise,
14:42 >perl -wE "my $t = 'and ... xxx said “This is a fantastic start +to the season”'; $t =~ tr/“”/\"/; say $t;" and ... xxx said "This is a fantastic start to the season" 14:43 >
Or combined into one:
14:46 >perl -wE "my $s = qq[Australia’s ‘Powder Capital’\nand ... xxx +said “This is a fantastic start to the season”]; $s =~ tr/‘’“”/''\"\" +/; say $s;" Australia's 'Powder Capital' and ... xxx said "This is a fantastic start to the season" 14:49 >
Hope that helps,
Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Replacing non ascii in string
by IanD (Initiate) on Jan 31, 2013 at 03:19 UTC | |
by Athanasius (Archbishop) on Jan 31, 2013 at 04:10 UTC | |
by IanD (Initiate) on Jan 31, 2013 at 05:21 UTC | |
by Anonymous Monk on Jan 31, 2013 at 08:41 UTC | |
by IanD (Initiate) on Feb 05, 2013 at 05:54 UTC |
In Section
Seekers of Perl Wisdom