in reply to Side effects of an /e modifier
I think the right hand side in an s///e block must be valid Perl. <td>foo($1)</td> is not valid Perl.
Quoting the HTML tags should work:
$bar =~ s#(\d{2})#"<td>".foo($1)."</td>"#mesg;
More code:
#!perl -w sub foo { "<$_[0]>" }; my $bar = '2299-33-ff'; $bar =~ s#(\d{2})#"<td>".foo($1)."</td>"#mesg; print $bar; __END__ <td><22></td><td><99></td>-<td><33></td>-ff
|
|---|