Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
with the result:$x = '123'; $y = $x; $y =~ s/(2)/?{$1+1}/x; print $y
But instead I get the following:133
Is there a regex way to that? The best non-regex way?1?{2+1}3
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl code in regex replacement
by toolic (Bishop) on Mar 12, 2011 at 18:16 UTC | |
|
Re: perl code in regex replacement
by ww (Archbishop) on Mar 12, 2011 at 17:29 UTC | |
|
Re: perl code in regex replacement
by Anonymous Monk on Mar 12, 2011 at 17:17 UTC | |
|
Re: perl code in regex replacement
by wind (Priest) on Mar 12, 2011 at 18:15 UTC |