Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Sorting a textfile by a date field

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


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
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-19 17:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found