Davorg's post above is on point, but here is how I deal with datastructures like this. Basically I localize a hash ref, to make the code slightly more visually appealing, ala..
for ( keys %category_hash ) {
my $first_lvl = $category_hash{$_};
print "$_\n";
for ( keys %{ $first_lvl } ) {
my $second_lvl = $first_lvl->{$_};
print ' ' x 3 . "$_"\n";
for ( keys %{ $second_lvl } ) {
print ' ' x 6 . "$_ : $second_lvl->{$_}\n";
}
} # END for keys $first_lvl
} # END for keys %category_hash
Grabbing a ref to the hash will be slightly better than creating a copy of the sub hashes as you go along. Personally I think it might be better to define a better structure like recommended above.
Regards
MMMMM... Chocolaty Perl Goodness.....