in reply to Sorting a hash of hashes

Your hash doesn't have any three letter keys, and your substr doesn't return three letters. Perhaps you meant:

my @key_hash = sort { substr($a,0,3) cmp substr($b,0,3) } keys %key_hash;

We're not surrounded, we're in a target-rich environment!