Welcome to the Monastery | |
PerlMonks |
Re: Hash Questionby tj_thompson (Monk) |
on Jan 10, 2011 at 22:17 UTC ( [id://881552]=note: print w/replies, xml ) | Need Help?? |
The problem is that you are updating your hash every time you see a new line. You need to update the hash conditionally on whether you've already seen the data you're interested in. Try changing your line: acct{$x} = ($x,$line);To: $acct{$x} = ($x,$line) unless exists $acct{$x}This way you only update your hash if you've never seen the account number before.
In Section
Seekers of Perl Wisdom
|
|