|go ahead... be a heretic|
Re^3: hash of hashesby jarich (Curate)
|on Nov 23, 2006 at 14:01 UTC||Need Help??|
Data::Dumper is your friend. I suspect you will find that if you Dump out %data between your first loop and your second, that you will find that you're storing more than the last line of each file. However strict is even more your friend, and could have saved you the time in posting on here.
If your second loop is a direct cut-n-paste then your error should be easily fixed. The following line:
Should probably be:
If you were using strict, Perl would have told you about this.
The following code works for me.
Be aware that if any id is repeated in the file for a different name, then you will only get the last unique pair. For example if your file contains:
Then you will only get the James => 4 pairing and Fred will be lost. If this is a problem, then you'll need to use an array reference:
Hope this helps.