my $s = "foo bar quux"; my $pattern = q(foo (.*?) quux); my $rep = q(foo quux $1); $s =~ s|$pattern|$rep}|; print "$s\n";I would like for this to print
foo quux barBut instead I get
foo quux $1How can I get the substitution operator to expand the $1 embedded in the replacement variable?
In reply to Back substitution expansion by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |