in reply to Does Perl support a given number of replacements ?
--marmot$x = 'ababababab'; $i=3; $x =~ s/(^|[^a])a([^a]|$)/$1B$2/ while $i--; print "$x\n" __END__ BbBbBbabab
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Does Perl support a given number of replacements ?
by Anonymous Monk on Jun 08, 2009 at 04:31 UTC |