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

Nothing looks wrong here. I mean, I would clean it up differently, but functionally, it seems ok.

use Data::Dumper; # ... my @Events; while (1) { eval { my %event = SECRET_PACKAGE_NAME::WaitForEvent($timeout); push @Events, \%event; print LOG Dumper(\%event); }; last if $@; } print LOG "=======\n", Dumper(\@Events);
Take the dumper lines out once you're convinced everything is working fine. But I would be extremely interested in whether there is a difference here or not. I expect no difference, and thus the problem is that the WaitForEvent sub is returning garbage (or returning something that isn't really a hash list).

That's just my gut feel on it...

Replies are listed 'Best First'.
Re^4: Creating an array of hash references
by Bobc (Initiate) on Mar 19, 2005 at 00:00 UTC
    Thanks for the replies. It turns out the problem was when I initialized the array to hold the references, I stupidly added a blank entry, so when I started pushing to the array it already had an entry. Duh. So my parsing routine puked at the first value, and when I examined the array, I looked at the first value, saw it was garbage. Thanks for putting me on the right track!