laziness, impatience, and hubris | |
PerlMonks |
Re^2: String substitutionby AnomalousMonk (Archbishop) |
on Sep 20, 2016 at 02:56 UTC ( [id://1172200]=note: print w/replies, xml ) | Need Help?? |
$str =~ s/.*nr(\d+)([^\d]+)(\d+)(.*)/"calc(nr$1)$2".eval{$3*4}."$4";/e;
FWIW: The separate eval{$3*4} is not needed (although it does no harm) because the entire replacement expression is already being eval-ed: Give a man a fish: <%-{-{-{-<
In Section
Seekers of Perl Wisdom
|
|