http://qs1969.pair.com?node_id=1147967


in reply to Re: Sorting a hash in a predetermined order
in thread Sorting a hash in a predetermined order

Hello ctilmes,

As long as you have the same set of hash keys, they will output in the same consistent order. (at least for the same version of perl..)

Not since v5.18.0! From perl5180delta:

By default, two distinct hash variables with identical keys and values may now provide their contents in a different order where it was previously identical.
...
The seed used by Perl's hash function is now random. This means that the order which keys/values will be returned from functions like keys(), values(), and each() will differ from run to run.

Of course, the order will remain consistent for a given, unchanged, hash variable throughout a single run of the program. But that won’t satisfy the OP’s requirements.

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,