does it mean that all items with indexes like ij with i=>2&&j>1 remain available ?

No. The array @all_with_name is cleared. The element at position 1 in the array reference in $all_with_names[2] has been copied to $gilligan_stuff, so it is there. If the thingy copied was a plain scalar, $gilligan_stuff holds a brand new copy of the contents of the array slot $all_with_names[2][1].

But if the entry in that slot was a reference, by copying that to $gilligan_stuff the reference count of the thingy that reference points to was increased, and the reference in $all_with_names[2][1] pointed to the same thingy.

By destroying the array @all_with_names the original data $all_with_names[2][1] was pointing to has not been deleted, although the slot $all_with_names[2][1] has been destroyed - only the pointer has been deleted. The reference count of the underlying data was decreased by deleting the array which held a reference to it, but until that count goes to zero the data is still allocated and accessible (if you have a refrence :-).

HTH,

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

In reply to Re: deleting array references by shmem
in thread deleting array references by spx2

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.