With Tree::DAG_Node for instance you can traverse the tree, running methods or simply and safely pruning and splicing the leaves and branches of your tree as you go along.
Untested...
my @leaves = (); $root->walk_down('callback' => sub { if (!scalar($_[0]->daughters)) # is it a leaf? push @leaves, $_[0]; return 1; } $root->add_daughters(@leaves);
In reply to Re: Moving data in a tree
by shoness
in thread Moving data in a tree
by hoffmann
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |