Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
to produce the output$string = 'string with word foo in it'; $string =~ s/(foo)/\1bar/g;
However this is instead giving me the output$string = 'string with word foo in it'; $find = '(foo)'; $replace = '\1bar'; $string =~ s/$find/$replace/g;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex prob with interpolated patterns
by halley (Prior) on Apr 06, 2004 at 17:29 UTC | |
|
Re: Regex prob with interpolated patterns
by Roy Johnson (Monsignor) on Apr 06, 2004 at 17:32 UTC | |
|
Re: Regex prob with interpolated patterns
by Enlil (Parson) on Apr 06, 2004 at 17:33 UTC | |
|
Re: Regex prob with interpolated patterns
by Paladin (Vicar) on Apr 06, 2004 at 17:33 UTC |