I would like to see "AZBC", for example but the $1 is interpreted as literal, as I suppose I should expect. Is there some way to have the replacement interpret $1, $2 etc?$string = 'ABC'; $search = qr/^(A)/; $replace = '$1Z'; $string = s/$search/$replace/g; say $string;
In reply to Interpolate into replacement with s//? by philkime
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |