in reply to Re^5: Interpolate into replacement with s//?
in thread Interpolate into replacement with s//?
gives:use 5.014000; use Config::General; my $conf = new Config::General({replace => 'Z\l$1Z'}); my $string = q/ABC/; my $search = qr/^(A)/; say $conf->{config}{replace}; my $replace = q/$conf->{config}{replace}/; $string =~ s/$search/$replace/gee; say $string;
I've tried all sorts of combinations of quoting and regexp flags but I can't seem to get it to work when $replace isn't explicitly assigned as in your example.Z\l$1Z Z\l$1ZBC
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Interpolate into replacement with s//?
by ikegami (Patriarch) on Nov 14, 2011 at 19:15 UTC | |
by philkime (Beadle) on Nov 23, 2011 at 13:29 UTC | |
by ikegami (Patriarch) on Nov 23, 2011 at 17:26 UTC | |
by philkime (Beadle) on Nov 24, 2011 at 07:58 UTC | |
by ikegami (Patriarch) on Nov 24, 2011 at 08:01 UTC | |
by Anonymous Monk on Nov 24, 2011 at 08:06 UTC | |
|