ido50 has asked for the wisdom of the Perl Monks concerning the following question:
This function only prints the root tree. I know there's more than one node (The root) in the tree because the number-of-nodes function returns the correct number. Also, when using IN_ORDER or POST_ORDER instead of PRE_ORDER, one of the root's children is printed instead.sub printcats { my ($class, $tree) = @_; my $printsub = sub { my $node = shift; print $node->{data}, "\n"; }; $tree->traverse($tree, $Tree::Nary::PRE_ORDER, $Tree::Nary::TRAVERSE_ALL, -1, $printsub ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need help with Tree::Nary
by matija (Priest) on Apr 26, 2004 at 12:17 UTC | |
by ido50 (Scribe) on Apr 26, 2004 at 12:53 UTC |