Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Selecting a particular record from groups of records

by Athanasius (Abbot)
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?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (11)
As of 2015-08-31 13:58 GMT
Find Nodes?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...

    Results (357 votes), past polls