I have a problem which I hope the wise ones will be able to assist with.
I have looked at The Perl Cook book and its suggestion Tie::IxHash which does not fit the bill on this occassion. The hash I am retrieving from is returned from XML::Simple::XMLin and I guess this does not use Tie::IxHash.
The data in the hash is complex, and represents job spec., perameters and run dates for jobs run on a night shift all of which need to be in a certain order.

My simple solution is to put an extra field containing a number in the XML. But this would mean re-numbering all the jobs should, as often happens, an extra job is inserted or one removed in the middle of the list, I'm sure you would agree wide open to error.

So can anyone give me some ideas on this one?
What I used in the end
For anyone interested I sorted out this problem at the XML stage by using this format
<groupname> <job> <jobname>foo<jobname> <runs>MONSATXBH</runs> </job> <job> <jobname>bar</jobname> <runs>ME</runs> </job> </groupname>
This gave me an array of hashes and of course an array comes out in the same order every time. Probably not as good as a SAX filter but this worked for me.

In reply to Retrieving from a hash in Insertion Order by Scarborough

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.