http://qs321.pair.com?node_id=180099


in reply to Re: Re: evaluating $1 in a replace string
in thread evaluating $1 in a replace string

Triple sweetness! Now I understand. I think I'll use the following version, because it gives me the same end result (having a double-quoted replacement expression on the final evaluation) and allows me to use the replacement expression as it is given to me.
#!/usr/bin/perl -w use strict; my $find = 'proof(\S+)'; my $rpl = 'read$1'; my $text = 'proofing is proof it needed to be proofed'; if ($text =~ s/$find/"\"$rpl\""/ee) { print "1st replacement made:\n\t$text\n"; }