The stupid question is the question not asked | |
PerlMonks |
Re: Building a hash from file and getting wrong result.by kcott (Archbishop) |
on May 15, 2017 at 20:41 UTC ( [id://1190347]=note: print w/replies, xml ) | Need Help?? |
G'day Ed, I didn't spend a huge amount of time going through your code; however, this part stood out as a potential problem:
That will expand all keys and values in the hash to form a list; that list will then be sorted and then reversed. Consider this minimal example of what's happening:
The foreach loop will set all keys and values to $recid; that will be twice the number of the keys and hence "an output file twice the size of the expected result". You probably want something closer to:
— Ken
In Section
Seekers of Perl Wisdom
|
|