in reply to having a hash maintain order when passed to a sub
I haven't tried but I expect passing it as a reference instead of letting it be flattened out into a list and copied into a new hash should do.