in reply to Re: Printing a tree-view of a hash of hashes
in thread Printing a tree-view of a hash of hashes

Maybe just a bit safer: test if it IS a hash:

sub print_tree { my ($tree, $depth) = (@_, 0); ref $tree eq "HASH" or return; my $indent = "..." x $depth; for (sort keys %$tree) { print $indent, /^\s*\z/ ? "<blank>" : $_, "\n"; print_tree ($tree->{$_}, $depth + 1); } } print_tree (\%categories);

Enjoy, Have FUN! H.Merijn