set up an array of values that define the order.
if the index of the current value is less than the previous value warn and inc the hash counter.
when doing the final list just foreach over the array and print out the number of items in the correct order. print "$item\n" x $hash{$item};