in reply to perl string pass by value

Please use [brackets around links] to make them clickable

I don't understand your question, http://perldoc.perl.org/5.20.0/perldelta.html#Performance-Enhancements and the passage you cite are pretty clear.

In some language like JS strings are immutable°, which means you can optimize the assignment by simply sharing the (internal) reference, only if one of the copies is changed you'll need to allocate new space for the cloned and changed content.˛

This has performance advantages if copies are rarely changed, and strings can become very long in Perl.

Perl has mutable strings, the reference of a scalar will point to the changed container.

NB: JS has no (external) references of so called "primitive types" (read scalars), i.e. no reference \$var operator at all. And JS doesn't have any "aliasing", where manipulating $_[0] will change the passed arguments of a sub.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Wikisyntax for the Monastery

UPDATES

°) https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures

Unlike in languages like C, JavaScript strings are immutable. This means that once a string is created, it is not possible to modify it. However, it is still possible to create another string based on an operation on the original string.

˛)

your example in JS:

var s = "foo"; var t = s; s += "bar";

means a new string s + "bar" constructed, allocated in memory and linked to the symbol s.

But in older Perl Versions $s and $t point to different memory locations, and the $s.="bar" means 3 letters are appended to the buffer holding the characters of $s. (if there is buffer space left)