Could you please explain the Dumper output if you have some free time?
By "I think" and "if I read what follows correctly", I meant to communicate that I'm not clear on the details relevant to this conversation. I've already described the relevant details beyond my understanding.
The only other relevant details might be FILL = 3 (4 elements are visible) and MAX = 3 (4 elements have been allocated). Perl sometimes allocate a larger array than it needs to speed up future push statements. It also has the option to speed up pop statements by not resizing the allocated block.
>perl -MDevel::Peek -le"@a=qw(a b c); Dump(\@a, 1); pop @a; Dump(\@a,
+1)"
SV = RV(0x183c550) at 0x2260b4
REFCNT = 1
FLAGS = (TEMP,ROK)
RV = 0x226dbc
SV = PVAV(0x22bfcc) at 0x226dbc
REFCNT = 2
FLAGS = ()
IV = 0
NV = 0
ARRAY = 0x1833fc4
FILL = 2 # 0..2 in use
MAX = 3 # 0..3 allocated
ARYLEN = 0x0
FLAGS = (REAL)
SV = RV(0x183c550) at 0x2260a8
REFCNT = 1
FLAGS = (TEMP,ROK)
RV = 0x226dbc
SV = PVAV(0x22bfcc) at 0x226dbc
REFCNT = 2
FLAGS = ()
IV = 0
NV = 0
ARRAY = 0x1833fc4
FILL = 1 # 0..1 in use
MAX = 3 # 0..3 allocated
ARYLEN = 0x0
FLAGS = (REAL)
Would you mind if I request you to explain that?
Did you ask the same question twice, or is this a different "that"?
-
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.
|