in reply to Specify Output of Keys in Hash

Your wish is very non-obvious to me: the keys in the desired output are not in alphabetical order, not in order of increasing or decreasing value, and not in insertion order.

So... What is your rule to determine the desired sort order? If it's not insertion order, then you might decide to just sort the keys. See the FAQ: How do I sort a hash (optionally by value instead of key)?