in reply to Looping through Multi Dimensional Hashes
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.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
|
|---|