Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-23 15:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found