in reply to Re^4: Can we make $& better? (need)
in thread Can we make $& better?
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.