in reply to Re^9: Interpolate into replacement with s//?
in thread Interpolate into replacement with s//?
I know your solution works when you directly give the replacement inline but not if the replacement itself is in a variable. Perhaps you could comment on how to do this in the above code?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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^11: Interpolate into replacement with s//?
by ikegami (Patriarch) on Nov 24, 2011 at 08:01 UTC | |
|
Re^11: Interpolate into replacement with s//?
by Anonymous Monk on Nov 24, 2011 at 08:06 UTC | |
by philkime (Beadle) on Nov 24, 2011 at 12:22 UTC |