in reply to substitution interpolation?

I don't know if you have the liberty of reformulating the contents of $sub, but if instead of '$1 spooge' maybe you can use '$1.q{ spooge}' and from there you can employ the /ee switch and gain major Perl purity points!

my $var = "my dog spot"; my $expr = "(my (dog|cat)) spot"; my $sub = '$1.q{ spooge}'; $var =~ s/$expr/$sub/ee; print $var;

--
g r i n d e r

Replies are listed 'Best First'.
Re: Re: substitution interpolation?
by larryk (Friar) on May 31, 2001 at 14:39 UTC
    bugger, I was just going to post this:
    #!perl -w use strict; my $var = "my dog spot"; my $expr = q|(my dog) spot|; my $sub = q|$1.' spooge'|; $var =~ s/$expr/$sub/ee; print $var;

    "Argument is futile - you will be ignorralated!"