in reply to Re^3: map and regexp. An newbie question
in thread map and regexp. An newbie question
No, but I got lucky! See perlop:
If the /r (non-destructive) option is used then it runs the substitution on a copy of the string and instead of returning the number of substitutions, it returns the copy whether or not a substitution occurred. The original string is never changed when /r is used. The copy will always be a plain string, even if the input is an object or a tied variable.
This applies even when /g is being used (otherwise what use would /r be, being that it's non-destructive?).
(Edit: to clarify, no, I didn't try it, but I did upon being chastened, found that it did work, and ran to docs to find out why!)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: map and regexp. An newbie question
by davido (Cardinal) on Oct 19, 2011 at 07:21 UTC | |
by anneli (Pilgrim) on Oct 19, 2011 at 07:50 UTC | |
by davido (Cardinal) on Oct 19, 2011 at 08:01 UTC |