in reply to Looping through Multi Dimensional Hashes

Hm, it seems like you're actually trying to code a tree, so I think life would be easier if you simply did it that way.

There are several tree modules on CPAN, and I can recommend Tree::MultiNode which is pretty complete, flexible and easy to use.

Hope this helps, -gjb-

  • Comment on Re: Looping through Multi Dimensional Hashes

Replies are listed 'Best First'.
Re: Re: Looping through Multi Dimensional Hashes
by CodeJunkie (Monk) on Jul 15, 2003 at 13:01 UTC

    Yeah thanks that is what I am trying to do, I will check out the module.

    Also found code and adapted to create this:

    foreach my $key1 (keys %category_hash) { foreach my $key2 (keys %{$category_hash{$key1}}) { if ($category_hash{$key1}{$key2}{name} eq '0') { $category_dropdown.="<p>$category_hash{$key1}{$key2}{name} Is +a top Level category</p>"; } else { $category_dropdown.="<p>$category_hash{$key1}{$key2}{name} Is +a sub Level category</p>"; } } }

    Take a look at the hash code here