[sf-perl] Pushing and Popping an array on the heap
nheller at silcon.com
Tue May 27 09:52:37 PDT 2008
Some of the advantages of using an array are the push and pop functions.
The following instantiates a reference on the stack that points to an
(anonymous) empty array on the heap:
What I would like to do is:
1. Instantiate a reference on the stack that points to an empty,
anonymous array on the heap.
2. "push" a reference ($a2ref) into the original anonymous array that
points to a secondary, anonymous array
3. "push" a series of references into the array referenced by $a2ref
An example might look something like the following:
$a1ref = [undef];
(The values to be pushed are as follows);
Finally, I would like to pop (or shift) values from $a1ref followed by the
individual members of the secondary array (such as $a1ref->).
The problem is that I don't have a clue (nor am I able to find) how to use
(or the syntax involved to) "push" (or unshift) and "pop" (or shift) values
into and out of this described data structure.
I appreciate any help I can get.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SanFrancisco-pm