in reply to Re^2: Allocation of anonymous arrays
in thread Allocation of anonymous arrays

... perl ... could indeed have @foo and @bar refer to the same storage initially. Then as soon as any code wanted to amend one of them, or even define a reference to them, perl could create a copy and start using that.

(Granted this probably wouldn't be a good idea ...)

You're right: Perl could do that, and it's a bad idea, and so Perl doesn't do that.

... each key array represents a test case in compact form ...

The representational form is compact, indeed: it is the nullity; it has ceased to be; bereft of life, it rests in peace. As soon as the anonymous array constructor  [ ... ] finishes its job, the reference it returns is immediately converted into a string and ceases to exist as a reference. Because the referent can no longer be accessed in any way whatsoever (because it has no reference), it is marked for garbage collection (its reference count is zero) and, in the fullness of time, it softly and silently vanishes away.