|
|
| No such thing as a small change | |
| PerlMonks |
Re: "exact" pattern matchingby spacebat (Beadle) |
| on Jun 10, 2008 at 02:13 UTC ( #691138=note: print w/ replies, xml ) | Need Help?? |
|
I agree with CountZero, it sounds like you want index() to get the starting position of the substring, then you can use substr() as an lvalue to assign your replacement string. However this sounds like what regular expressions were designed for, so either quotemeta() or the following may be a better fit: s/\Q$pattern\E/$replacement/g
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||