The answers above are probably enough to solve your
problem, but just for reference, there's always the
module. It provides hashes that
preserve the order in which the elements were added.
The elements can also be ordered in other ways.
Look up the documentation for
for
a better explanation of all it's features.