Thanks to all for the replies. I see now that I did not make my problem clear enough. My script is accessing a company-proprietary package that interfaces with the server. The "Read()" routine from the package returns a hash. Depending on the event being read, the hash will have a different set of key/value pairs, but each hash contains an ID key/value pair so that the calling code can process the data correctly:
my %event = SECRET_PACKAGE_NAME::WaitForEvent($timeout);
My script is initiating an action which causes the server to spit out data at a much higher rate than normal. Originally I was reading a single hash and processing it real-time. Running some external diagnostics showed that I was missing some key data, so I decided to run a tight loop to collect ALL the data. I tried the following which didn't work:
my @Events; while(1) { my %event = (); eval { %event = SECRET_PACKAGE_NAME::WaitForEvent($timeout); }; if($@) { # timeout occurred, serial burst complete last; } else { push (@Events, \%event); } }# end while ... while(@Events) { # Get the first event, NOT the last one my $EventRef = shift(@Events); } # $EventRef points to garbage
Does this clarify my issue? I need to preserve all the key/value pairs of the received data somehow so that I can post-process the information. Thanks again for the responses

In reply to Re^2: Creating an array of hash references by Bobc
in thread Creating an array of hash references by Bobc

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.