in reply to Recursion problem

The declaration my ($node, $all) = @_; in traverse() does shadow your global variable $all defined in my $all; above. That could be part of the problem.

Update: No, it's not the problem. You use the global $all for the value and the local $all for a reference to this. I think ChemBoy found your problem.

Christian Lemburg
Brainbench MVP for Perl
http://www.brainbench.com