in reply to ref defines array element?

Easy. You create a reference. It's impossible in Perl to have a reference pointing to nothing - it always has to point to something, even if that something is undefined. You ask Perl to create a reference to $y [0]. $y [0] doesn't exist yet, so Perl conveniently creates it for you, just as it would do if you assign to it.

Now, after you are done with the 'ref', the reference disappears due to garbage collection, but $y [0] doesn't, as it's now in the array and hence still has a ref count of 1.

Abigail