in reply to substitution problem with ()
The first argument of the substitution operator (s///) is a regexp, not arbitrary text. An easy way to convert arbitrary text into a regular expressions in to use quotemeta.
my $from_re = quotemeta($_); s/$from_re/$to/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: substitution problem with ()
by bart (Canon) on Jun 12, 2007 at 17:01 UTC |