in reply to Help with Hash of hashes, is there a better way?

This is kind of similar to roboticus's post, and also in nature to wfsp's SQL suggestion (because this is how the data would end up coming out of it.

You could do the nested loop-age just once, and build an array of hashrefs that each have all the information. Then just loop through that whenever needed.
my @targets; while(my($env,$platform_href) = each %{$stuff}) { while(my($platform,$host_href) = each %{$platform_href}) { while(my($host,$target_href) = each %{$host_href}) { while(my($target,$capacity_href) = each %{$target_href}) { push @targets, { env => $env, platform => $platform, host => $host, target => $target, total_capacity => $capacity_href->{'total_capacity'} +, free_capacity => $capacity_href->{'free_capacity'}, }; } } } } # now, whereever you previously had the 4 nested loops, just do: foreach my $target ( @targets ){ # Do stuff with these keys of %$target: # env # platform # host # target # total_capacity # free_capacity }