in reply to Re: Getting information from an array of hashes
in thread Getting information from an array of hashes

Thanks for the reference. I've looked through it, and there's some good stuff there to digest. However, one of the examples in perlman:perldsc is almost identical to something I already tried, following an example in Programming Perl.

for ($i = 0 ; $i <= $#diary_data ; $i++ ) { print "$i is { "; for $temp_keys ( keys %{ $diary_data[$i] } ) { print "$temp_keys=$diary_data[$i]{$temp_keys} "; } print "}\n"; }

This still generates an error. I broke it down to do one step at a time, like this:

for ($i = 0 ; $i <= $#diary_data ; $i++ ) { print "I: $i\n"; for $temp_keys ( keys %{ $diary_data[$i] } ) { print "Key: $temp_keys\n"; print "Data: $diary_data[$i]{$temp_keys}\n"; } }

This gives

I: 0 Key: timestamp Use of uninitialized value at ./ line 197. Data: Key: value Argument "NWORLASTE800 LOGIN FAILED\nNWORLASTE801 LOGIN FAIL\n\nWA..." + isn't numeric in helem at ./ line 197. Bad index while coercing array into hash at ./ line 19 +7. $

However, if I comment out the line that starts with print "Data...", it prints the correct keys for this hash:

I: 0 Key: timestamp Key: value Key: user

What confuses me is the fact that I'm following examples straight out of Perl references and getting these errors. I'm starting to wonder if I've found a bug in