Even though you can't directly maintain a hash in a specific order (unless you use the Tie::IxHash module mentioned in
Recipe 5.6
), you can access its entries in any order.

This technique offers many variations on the same basic mechanism: You extract the keys, reorder them using the
sort
function, and then process the entries in the new order. All the sorting tricks shown in
Chapter 4,
Arrays
, can be used here. Let's look at some applications.