This is a strange one, but I've spent a whole day on it and I still can't figure it out.
I'm using the loop:
foreach my $article (keys %locations) { process_article(*WFH, \%{$locations{$article}}, [], \@all_chro +ms); }
Basically what it does is go over the keys of a hash of hashes and pass the hash associated with each key on to a sub-routine. It does this fine for all entries except the last one. The last one it passes as having no values (that is $article=''). I can't figure out why. I printed all the keys to the hash of hashes just before the last iteration to make sure they're all there and they are. Also, a few lines before this loop I call it similarly:
foreach my $article (keys %locations) { process_article(*WFH, \%{$locations{$article}}, \@{$lists{"$li +st"}}, \@all_kwords); }
And this works just fine. The only difference I can see between the two loops is that I'm passing a reference to a full array instead of an empty one.
Any ideas?
-----------------------------------
Any comments about coding style are welcome.In reply to Problem with a hash of hashes by dannoura
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |