# Assumes top hash key is in the form: # hostname:platform:env # and the second-level hash key is: # target # and since the lowest level of your example is always the # same structure, we put the values in an array: # [0] = total_capacity # [1] = current_free_space while (my ($hostkey,$targets_href) = each %{$stuff}) { # *This* report doesn't care about prod/dev or OS, it's # just to warn about disk space problems, so only need # $host... Other reports may want other bits my ($host,undef) = split /:/,$hostkey; print "\n*****\n* $host\n*****\n\n" . "FreeSpc %Free Target\n" . "-------- ----- -----------------\n"; while (my ($target,$cap_href) = each %{targets_href}) { my $pct_free = $cap_href[1] * 100.0 / $cap_href[0]; if ($cap_href[1] < $warn_pct * $cap_href[0]) { printf "% 8u %5.3f %s\n", $cap_href[1], $pct_free, $target; } } }