|
|
| Syntactic Confectionery Delight | |
| PerlMonks |
Re^5: Can we make $& better? (need)by demerphq (Chancellor) |
| on Sep 12, 2007 at 19:24 UTC ( #638654=note: print w/ replies, xml ) | Need Help?? |
|
Hrm, ill have to check the code in more detail, however I'm pretty sure that /g in list context copies the string *once*, wheras /g in scalar context doesn't copy it at all. The latter I know because i "fixed" it in 5.9.5 and then had to back out the fix because it caused an unacceptable slowdown. However as far as I know you were correct, using capturing parens will cause a copy of the full string. Ill try to follow up with more details from the code when I have more time.
--- $world=~s/war/peace/g
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||