Given that your disordered output is going to a single stream, it is unlikely that there is a buffering problem. Order-related buffering problems tend to apply primarily to output that involves multiple streams (e.g. STDERR and STDOUT).

Even though you think that the hashes are filled, how exactly did you determine that the output you are seeing for hash X really belongs to hash X? It seems to me that the normal way of showing that: a title, followed by a hash content dump is exactly what you are doing - and it says otherwise. Additionally, pudelli has demonstrated that when prepopulated hashes are used (without all the SQL to populate it), your code works as expected.

The SQL query within the foreach loop is pretty complicated, and that is even after you have simplified it to remove security information. So the more likely thing is that the branches that fill the various hashes aren't actually being visited in the way you expect and hence haven't been filled. Have you tried distinctive print STDERR statements at each place where you think the hash members are being added -e.g. print STDERR "filling new student reg hash key=<$key> value=<$value>"?.

BTW, no need to apologize for asking a "noob" question - the only way to "unnoob" yourself is to be a noob and ask. This is especially true when it comes to debugging - learning what to focus on takes time and happens much more quickly when we can share experiences. Thumbs up for a well formulated question.

Best, beth


In reply to Re: Printing out of order... by ELISHEVA
in thread Printing out of order... by kdmurphy001

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.