<?xml version="1.0" encoding="windows-1252"?>
<node id="970333" title="Re^2: Update references" created="2012-05-13 17:00:33" updated="2012-05-13 17:00:33">
<type id="11">
note</type>
<author id="888573">
Eliya</author>
<data>
<field name="doctext">
&lt;p&gt; The reference refers to the &lt;i&gt;scalar&lt;/i&gt; retrieved via &lt;c&gt;$a[0]&lt;/c&gt;, not the array index [0].&amp;nbsp; The reference knows nothing about the array that scalar came from.&amp;nbsp; And the scalar will exist as long as its refcount is &gt; 0. &lt;/p&gt;
&lt;c&gt;
$ perl -MDevel::Peek -E'@a=qw(a b c); $r=\$a[0]; Dump $r; @a=(); Dump $r'
SV = IV(0xa95bc0) at 0xa95bd0
  REFCNT = 1
  FLAGS = (ROK)
  RV = 0xa77998
  SV = PV(0xa75c20) at 0xa77998
    REFCNT = 2                   &lt;---
    FLAGS = (POK,pPOK)
    PV = 0xa8ee40 "a"\0
    CUR = 1
    LEN = 16
SV = IV(0xa95bc0) at 0xa95bd0
  REFCNT = 1
  FLAGS = (ROK)
  RV = 0xa77998
  SV = PV(0xa75c20) at 0xa77998
    REFCNT = 1                   &lt;---
    FLAGS = (POK,pPOK)
    PV = 0xa8ee40 "a"\0
    CUR = 1
    LEN = 16
&lt;/c&gt;
&lt;p&gt; (note the refcounts) &lt;/p&gt;</field>
<field name="root_node">
970288</field>
<field name="parent_node">
970326</field>
</data>
</node>
