in reply to Using 'e' in s///
My guess is that when you do the first portion of the subtitiution, Perl looks for any capturing matches and fills in $1, $2, etc. as needed. Since there aren't any captures, the values of the capturing vars are undef by the time it gets to the second part of the substitution.
To get around this, save the value of $2 before you do your substitution.
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
Note: All code is untested, unless otherwise stated
|
|---|