$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:
$str =~ s/.*nr(\d+)([^\d]+)(\d+)(.*)/"calc(nr$1);$2" . $3*4 . $4/e;
(tested, and I also stuck the semicolon back where kepler seems to want it).
Give a man a fish: <%-{-{-{-<
In reply to Re^2: String substitution
by AnomalousMonk
in thread String substitution
by kepler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |