I remember that thread.

If I'm not mistaken, print "$var\n" or print $var, "\n" looks like the thread, and Re: print "$var\n" or print $var, "\n" would be the post that uses Devel::Peek's Dump function to show the variable's internal state.

Here are results of perl -MDevel::Peek -le "$b=[1,2,3]; $#a=$b;Dump $b;Dump $#a"

SV = RV(0x1a5596c) at 0x1a44f68 REFCNT = 1 FLAGS = (ROK) RV = 0x15d50e0 SV = PVAV(0x15d674c) at 0x15d50e0 REFCNT = 2 FLAGS = () IV = 0 NV = 0 ARRAY = 0x15dd1c4 FILL = 2 MAX = 2 ARYLEN = 0x0 FLAGS = (REAL) Elt No. 0 SV = IV(0x1a49240) at 0x15d51dc REFCNT = 1 FLAGS = (IOK,pIOK) IV = 1 Elt No. 1 SV = IV(0x1a49244) at 0x15d51e8 REFCNT = 1 FLAGS = (IOK,pIOK) IV = 2 Elt No. 2 SV = IV(0x1a49248) at 0x15d5200 REFCNT = 1 FLAGS = (IOK,pIOK) IV = 3 SV = PVMG(0x1a6cfc4) at 0x15d520c REFCNT = 1 FLAGS = (GMG,SMG,ROK) IV = 0 NV = 0 RV = 0x15d50e0 SV = PVAV(0x15d674c) at 0x15d50e0 REFCNT = 2 FLAGS = () IV = 0 NV = 0 ARRAY = 0x15dd1c4 FILL = 2 MAX = 2 ARYLEN = 0x0 FLAGS = (REAL) Elt No. 0 SV = IV(0x1a49240) at 0x15d51dc REFCNT = 1 FLAGS = (IOK,pIOK) IV = 1 Elt No. 1 SV = IV(0x1a49244) at 0x15d51e8 REFCNT = 1 FLAGS = (IOK,pIOK) IV = 2 Elt No. 2 SV = IV(0x1a49248) at 0x15d5200 REFCNT = 1 FLAGS = (IOK,pIOK) IV = 3 PV = 0x15d50e0 "" CUR = 0 LEN = 0 MAGIC = 0x1a6e114 MG_VIRTUAL = &PL_vtbl_arylen MG_TYPE = PERL_MAGIC_arylen(#) MG_OBJ = 0x15d51a0

The SV slot for both variables hold a reference to the anonymous array (PVAV(0x15d674c) at 0x15d50e0), and "SV = PVMG" means either "magic is attached or the value is blessed"1 The first SV is $b, the second SV is $#a.

Maybe someone with a little more knowledge of perl internals can help interpret this...

1 From PerlGuts Illustrated


In reply to Re^2: Putting weird things into $#array by bmann
in thread Putting weird things into $#array by blokhead

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.