in reply to Arbitrary Levels Of Recursion?

I see no recursion.

Replies are listed 'Best First'.
Re^2: Arbitrary Levels Of Recursion?
by perlfan (Parson) on Apr 01, 2005 at 20:08 UTC
    There is no recursion, just nested loops as you suspect.

    For the OP's benefit, this is a recursive way to traverse a binary tree using 'depth first':
    my $tree = init_tree(); # not shown here my $new_tree = traverse($tree); sub traverse { my $tree = shift; if (defined($tree->{left})) traverse($tree); } if (defined($tree->{right})) traverse($tree); } # .. do stuff return $tree; }