for my $d (sort {$descs->{$a} cmp $descs->{$b}} keys %{ $descs = {map {$_ => $hash{$_}{desc}} keys %hash}} ) { ... ... }