in reply to Replacing single quotes to two single quotes inside map
Hello Anonymous Monk,
Try something like that:
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my @in = ("Maria's", "Thano's"); my @out = map { s/'/"/g; $_ } @in; print Dumper \@out; __END__ $ perl test.pl $VAR1 = [ 'Maria"s', 'Thano"s' ];
Update: Got late in my post due to experimentation. Did not copied fellow Monk duff code. Just to avoid confusion.
Hope this helps, BR.
Seeking for Perl wisdom...on the process of learning...not there...yet!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Replacing single quotes to two single quotes inside map
by AnomalousMonk (Archbishop) on Nov 10, 2017 at 23:33 UTC | |
by hippo (Bishop) on Nov 11, 2017 at 11:48 UTC | |
by Anonymous Monk on Nov 14, 2017 at 15:09 UTC | |
by choroba (Cardinal) on Nov 14, 2017 at 17:01 UTC | |
by Anonymous Monk on Nov 14, 2017 at 19:47 UTC |
In Section
Seekers of Perl Wisdom