http://qs321.pair.com?node_id=776154


in reply to Re^4: how to construct tree from parent pointer list
in thread how to construct tree from parent pointer list

For example, what is '$cb'

The first argument. It's expected to be a code reference.

What I am trying to do is output the tree in a flattened format once the tree is built.

Based on the code from Re: Tree path analyzer regex problem (maybe other issues)?, a reply in an older thread of yours,

sub leaves { my $node = shift; my @children = $node->children(); if (!@children) { print(join('|', @_), "\n"); } else { for my $child (@children) { leaves($child, @_, $child->value()); } } }