in reply to Not in order in Hash output

perldoc perldata:
Note that just because a hash is initialized in that order doesn't mean that it comes out in that order. See "sort" in perlfunc for examples of how to arrange for an output ordering.
Sorry if my advice was wrong.