in reply to Sorting hash references

You can't get the original order from a hash reference. That information is not preserved anywhere.

However, if you control the code that calls your code, you might get them to us Tie::IxHash objects instead of ordinary hashrefs, and that does preserve the order.