Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Hash Question

by tj_thompson (Monk)
on Jan 10, 2011 at 22:17 UTC ( [id://881552]=note: print w/replies, xml ) Need Help??


in reply to Hash Question

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://881552]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-04-23 21:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found