use strict; use warnings; my %disk_space = ( host_A => { '/' => 0.22, '/var' => 0.51, '/opt' => 0.79, '/home' => 0.17, }, host_B => { '/' => 0.31, '/var' => 0.82, '/opt' => 0.99, '/home' => 0.22, }, ); printf( "%-10s:%-10s -> %.2f\n", @{$_} ) for sort { $a->[2] <=> $b->[2] } map{ my $host = $_; map{ [ $host, $_, $disk_space{$host}{$_} ] } keys %{ $disk_space{$host} }; } keys %disk_space;