Jim Gibson <> wrote:
> I am not quite sure why '$d =~ /$oldpart/$newpart/e;' doesn't work,
Because the replacement part is now code rather than a string.
If you instead said
$foo = $newpart;
you would expect a literal '$1' in $foo's value, as there is only
one round of evaluation and that is used to fetch the value from $newpart.
Same thing for the code above.
> but
> wrapping the replacement text in double quotes and forcing another
> round of evaluation works:
That would be like
$foo = eval $newpart;
were you _would_ expect variables in $newpart's value to be eval()uated.
--
Tad McClellan SGML consulting
Perl programming
Fort Worth, Texas