Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Try this:

use Devel::Peek; ... sub save { Dump $_[0]; push(@savearr, \$_[0]); readonly_on(${$savearr[-1]}); Dump ${$savearr[-1]}; } ... __END__ SV = PV(0x75cbc8) at 0x88d238 # REFCNT = 1 FLAGS = (PADTMP,POK,pPOK) PV = 0x77e340 "begin 0 end"\0 CUR = 11 LEN = 16 SV = PV(0x75cc68) at 0x75ef48 REFCNT = 1 FLAGS = (POK,READONLY,pPOK) PV = 0x77e940 "begin 0 end"\0 CUR = 11 LEN = 16 SV = PV(0x75cbc8) at 0x88d238 # REFCNT = 1 FLAGS = (PADTMP,POK,pPOK) PV = 0x77e340 "begin 1 end"\0 CUR = 11 LEN = 16 SV = PV(0x75cce8) at 0x7836b8 REFCNT = 1 FLAGS = (POK,READONLY,pPOK) PV = 0x78cc60 "begin 1 end"\0 CUR = 11 LEN = 16 SV = PV(0x75cbc8) at 0x88d238 # REFCNT = 1 FLAGS = (PADTMP,POK,pPOK) PV = 0x77e340 "begin 2 end"\0 CUR = 11 LEN = 16 SV = PV(0x75ccf8) at 0x783700 REFCNT = 1 FLAGS = (POK,READONLY,pPOK) PV = 0x87bb70 "begin 2 end"\0 CUR = 11 LEN = 16 SV = PV(0x75cbc8) at 0x88d238 # REFCNT = 1 FLAGS = (PADTMP,POK,pPOK) PV = 0x77e340 "begin 3 end"\0 CUR = 11 LEN = 16 SV = PV(0x75cd08) at 0x783748 REFCNT = 1 FLAGS = (POK,READONLY,pPOK) PV = 0x87bcd0 "begin 3 end"\0 CUR = 11 LEN = 16 $VAR1 = [ \'begin 0 end', \'begin 1 end', \'begin 2 end', \'begin 3 end' ];

Note that the marked instances are in fact the same scalar.  A new one isn't created before pushing it onto the array.


In reply to Re: lexicals are all the same scalar and never go out of scope? by Eliya
in thread lexicals are all the same scalar and never go out of scope? by patcat88

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others contemplating the Monastery: (7)
    As of 2014-12-27 15:06 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (177 votes), past polls