in reply to Storing substitution patterns

Adding /e tells perl to treat the replacement part as code, and execute it. The code is $regexes{$re}[1]. If you "execute" that, you get the same as you would interpolate it - you get $1 $3. What you want is to execute that. To do so, tag /ee (double execution) at the end, not just a /e.

Abigail

Replies are listed 'Best First'.
Re: Re: Storing substitution patterns
by duff (Parson) on Feb 11, 2004 at 15:22 UTC

    D'oh. Abigail is entirely correct. Though you will need to change '$1 $3' to something like 'qq($1 $3)' or '"$1 $3"'.

Re: Storing substitution patterns
by abulafia (Sexton) on Feb 11, 2004 at 16:22 UTC
    That was it! Thanks, Abigail. You're the best.

    (Didn't know one could specify /ee... that gives me all sorts of evil ideas...)