[Pdx-pm] Newbie question about data structures and stacks and recursion
krisb at ring.org
Wed Nov 30 13:55:19 PST 2005
On Wed, 30 Nov 2005, Keith Lofstrom wrote:
> I realize that if I copy references in an array or hash, I get a
> reference to data, not a separate copy of the data.
> I want to build a recursive subroutine for exploring a branching
> decision tree, and I would like to glom together a bunch of scalars,
> arrays, and hashes into a data structure of some kind and push them
> onto a stack at the beginning of a routine, and pop them off after.
Keith, do you really need to copy the entire structure?
Also, do you plan to have objects in the structure?
Randal has a deep_copy subroutine here:
More information about the Pdx-pm-list