in reply to Modifying the match position after each match
Some other variations:
use strict; use warnings; use 5.010; my $string = "_'nada_komo_el_'sol_"; $string =~ s/_'?(.)/_'$1/g; say $string; --output:-- _'nada_'komo_'el_'sol_
---
use strict; use warnings; use 5.010; my $string = "_'nada_komo_el_'sol_"; my @pieces = split /_'?/, $string; say join(q{_'}, @pieces); --output:-- _'nada_'komo_'el_'sol
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Modifying the match position after each match
by pat_mc (Pilgrim) on Mar 24, 2010 at 09:03 UTC | |
by BrowserUk (Patriarch) on Mar 24, 2010 at 13:17 UTC | |
by Corion (Patriarch) on Mar 24, 2010 at 13:23 UTC | |
by BrowserUk (Patriarch) on Mar 24, 2010 at 13:29 UTC |