good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Interpolate into replacement with s//?by SuicideJunkie (Vicar) |
on Nov 09, 2011 at 20:40 UTC ( [id://937213]=note: print w/replies, xml ) | Need Help?? |
It was a little hard to find, but this may be what you want: perlretut Says:A modifier available specifically to search and replace is the s///e evaluation modifier. s///e treats the replacement text as Perl code, rather than a double-quoted string. The value that the code returns is substituted for the matched substring. s///e is useful if you need to do a bit of computation in the process of replacing text. This example counts character frequencies in a line:
In Section
Seekers of Perl Wisdom
|
|