Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Selecting a particular record from groups of records

by Athanasius (Monsignor)
on Sep 20, 2012 at 13:27 UTC ( #994663=note: print w/ replies, xml ) Need Help??


in reply to Selecting a particular record from groups of records

In Perl, the rule is: When in doubt, use a hash!

So, create an empty hash. Then read the data file, one record at a time: if its date/time is not already a key in the hash, store whatever values you need against this new key. If the date/time is already in the hash, compare the QC flags — if the new record has a smaller value, substitute the new record’s details for those currently stored against that date/time.

When all records have been read, output the hash contents, sorted by their date/time keys.

Hope that helps,

Athanasius <°(((><contra mundum


Comment on Re: Selecting a particular record from groups of records

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (19)
As of 2014-10-30 15:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (208 votes), past polls