http://www.perlmonks.org?node_id=1003503


in reply to Concatenate or Join?

Simple, concat doesn't create a new copy, it's just enlarging the old one as long as the allocated buffer allows to.

I think you are confusing Perl with languages like JS, Java or Python where (the memory representation) of strings is immutable, i.e. can only be created, read or deleted but never updated.

see also http://stackoverflow.com/questions/51185/are-javascript-strings-immutable-do-i-need-a-string-builder-in-javascript

Cheers Rolf