in reply to Re: map & arrays & recursion
in thread map & arrays & recursion
Without knowing the contents of $self->{children} or the side-effects/return values of $node->traversal()
Presumably, traversal traverses a tree. The children of a node are likely of the same type as that node, which makes traversal a recursive function.
I cannot provide any additional insight.
The OP's first snippet returns the nodes of the tree in pre-order.
The OP's second snippet is obviously broken, traversing the entire tree to get only the nodes of depth one and two.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: map & arrays & recursion
by Anonymous Monk on Oct 02, 2010 at 00:06 UTC | |
by ikegami (Patriarch) on Oct 02, 2010 at 04:21 UTC |