in reply to
String substitution
If I understood correctly, you want to replace (nr\d+) with "calc($1);" and multiply other occurences of \d+ by 4. This can be done with a single regex:
$data =~ s/(nr)?(\d+)/$1 ? "calc($1$2);" : $2 * 4/ge;
[download]
This will match both nr\d+ and \d+ and then decide how to replace it based on the presence of "nr".
Comment on
Re: String substitution
Download
Code
In Section
Seekers of Perl Wisdom