For what little it is really worth, you do not need the e
modifier on this version ( as opposed to chromatic's
suggestion ).
Both parts of the regex get double-quotish expansion, which
will cause $hash{$1} to be expanded correctly.
The original problem was using the \1 as the
backreference. That has been depricated since at least
perl 5.004 ( maybe earlier, I cannot remember precisely ).
In fact, if you try to use the \1 on the command line and
use perl -w, it will complain quite loudly. The moral here,
of course, is make sure you use -w when developing code.
You also used the single quotes ('') around the variable,
which would have prevented the \1 from being expanded even
if \1 wasn't deprecated. Remember, single quotes mean
literally and double quotes will do... well, double-quotish
expansion.
Mik
|