in reply to Re: Re: substitution interpolation?
in thread substitution interpolation?

Thanks for pointing out my totally clueless use of qr// (was going on the advice of someone on IRC when I went down that path, instead of RTFM'ing). What I don't understand is- why does the evaling the entire expression work? Does it force interpolation of $lhs and $rhs before the expression is evaluated? In experiments,
$_ = $var; eval "s/$lhs/$rhs/";
works, but:
eval "$var =~ /$lhs/$rhs/;";
doesn't work- what am I missing?

Replies are listed 'Best First'.
Re: Re: Re: Re: substitution interpolation?
by lestrrat (Deacon) on May 31, 2001 at 06:47 UTC

    try this:

    eval "\$var =~ s/$lhs/$rhs/";

    update:fixed typo