$replace contains a template. Therefore, you need a template engine to process it.Aw /gee whiz, we don’t need no stinkin’ modules for such a trivial task. Merely render unto Perl that which is Perl’s:
Which when run duly prints out ZaZBC.use v5.14; my $string = q/ABC/; my $search = qr/^(A)/; my $replace = q/"Z\l$1Z"/; $string =~ s/$search/$replace/gee; say $string;
In reply to Re^3: Interpolate into replacement with s//?
by tchrist
in thread Interpolate into replacement with s//?
by philkime
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |