Your suggestion works ... but the question was a bit more complicated because $temp = 'foo$1bar'. And then the simple evaluation doesn't work ... you have to employ a little extra trick (proposed by japhy a couple of days ago):
$temp0="ZO"; $temp1='foo$1bar'; $x="ABCZO"; $x =~ s/([A-Za-z]+)$temp0/qq[qq[$temp1]]/ee; print $x; # prints fooABCbar
-- Hofmator
In reply to Re: Re: Pattern Matching
by Hofmator
in thread Pattern Matching
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |