in reply to Re^2: Array or Hash
in thread Array or Hash
That's not a sparse array. It has 10,000,001 allocated slots, all of which are in use.
You make "keeping track of valid values" sound very complicated but it's just 3 numbers.
>perl -MDevel::Peek -e"$a[6]=1; $a[7]=1; shift(@a); Dump(\@a,1)" SV = IV(0x1acf60) at 0x1acf68 REFCNT = 1 FLAGS = (TEMP,ROK) RV = 0x336af0 SV = PVAV(0x1adc30) at 0x336af0 REFCNT = 2 FLAGS = () ARRAY = 0x330590 (offset=1) -- Address of first element ALLOC = 0x330588 FILL = 6 -- Index of last element MAX = 12 -- Index of last allocated element ARYLEN = 0x0 FLAGS = (REAL)
The array has 7 elements and 14 allocated elements (-1..12 relative to ARRAY).
Update: Replaced description with an example.
|
|---|