in reply to Re^2: Creating an array of hash references
in thread Creating an array of hash references
I think what's wrong there is that you're pushing the same reference to the same hash over and over onto your array, and also clearing and refilling that hash on each iteration.
What you probably want to do instead is push a reference to an anonymous copy of "%event":
(I could be wrong, but I think this is worth a try.)while(1) { my %event = (); eval { %event = SECRET_PACKAGE_NAME::WaitForEvent($timeout); }; if($@) { # timeout occurred, serial burst complete last; } else { push (@Events, { %event }); } }# end while ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Creating an array of hash references
by Tanktalus (Canon) on Mar 19, 2005 at 00:20 UTC |