in reply to Re^5: 5.42: Does m// toss a string around?
in thread 5.42: Does m// toss a string around?
COW is normally used for the copy for $& and friends, but it wasn't used in this case because there's not enough space in the buffer
Thanks. I think it follows that appending a character practically poisons a string in Perl (try 1e7 if on modern PC):
$ time perl -e '$_ = "a" x 1e6; $_ .= "a"; 1 while /./g' real 0m35.868s user 0m35.857s sys 0m0.008s
|
|---|