in reply to Side effects of an /e modifier

Yet another solution (:

You can eval random code inside (?{ }) and use result with variable $^R

$bar =~ s#\d{2}(?{ $& * 5})#<td>$^R</td>#gms;

More information:

perldoc -v '$^R' perldoc -v '$&' perldoc perlre

And I want to point, that you don't need to capture whole match. It will already situated in $&

P.S.

I should have said, that there is global performance penalty for using $& somewhere in your code. It was fixed only in 5.020

Please read following documentation for more information:

perldoc perlfaq6 perldoc perlvar