Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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?
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 drinking their drinks and smoking their pipes about the Monastery: (11)
As of 2015-07-28 11:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (254 votes), past polls