in reply to Re^3: Using grep to remove array element from HoAoH leaving empty array-hash element
in thread Using grep to remove array element from HoAoH leaving empty array-hash element
I've narrowed it down to this bit of code, but for the life of me I can't see how or why it would be adding the empty hash. I've also noticed that I lose the data in the 1958 array after the first iteration of the for loop.
Basically I'm going through each of the years I have data for and seeing if my match appears in any of those years. If it does, it gets put in to @res for display in a list.
Here's the offending code:
for $find qw((1958 1959 1960 1961 1962 1963 1964)){ $index = 0; # index is defined to go down the array of each year while (defined $bros->{$find}->[$index]->{$key}){ if ($bros->{$find}->[$index]->{$key} =~ /$data/i){ # since we found one, we push the brothers data structure a +nd # year of graduation in to the results hash push (@res,{brother => $bros->{$find}->[$index], year => $f +ind}); } # end if $index++; } # end while } # end find
I'd appreciate anything you could suggest as to where this might be adding the empty hash!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Using grep to remove array element from HoAoH leaving empty array-hash element
by Aristotle (Chancellor) on Aug 11, 2004 at 22:31 UTC |