foreach my $k sort { $hash{$a}{value} <=> $hash{$b}{value} } (keys %hash)