my %HoA; my $k; my $root = 1; my $ctr =1; for $k (sort keys %HoA){ walktree($root) unless $k eq""; } sub walktree{ my $id = shift; $HoA{$k}[2]=$ctr++ if $id = $k; ##The walktree recursive sub below enters an eternal loop ##and doesn't execute properly. When I tried to push the ##children elements to a temporary array, it worked just ##fine. Would it be the $id??? walktree($id) if $id =$HoA{$k}[1] ; $HoA{$k}[3]=$ctr++; local $" = "|"; print "$k = @{$HoA{$k}}\n"; }