Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
"be consistent"
 
PerlMonks  

Re: Sorting a textfile by a date field

by matthewb (Curate)
on Oct 01, 2003 at 01:48 UTC ( [id://295520]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Sorting a textfile by a date field

How far have you got?

There is, as ever, more than one way to do it but if you only have 250 lines to deal with it seems reasonable to get it all into a suitable data structure and then operate on that.

It sounds like this will involve little more than splitting on whitespace in a while loop.

But what then? Are the dates unique? If so, you could make them keys in a hash and just output it with a sort { date_sorting_code() } keys %hash. But it could be more complicated than that.

I reckon if you gave a few sample lines and clarified some characteristics your problem could be solved in a few minutes.

MB

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://295520]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.