Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: How to sort data in the input file ?

by fmerges (Chaplain)
on Feb 08, 2007 at 21:45 UTC ( [id://599159]=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 How to sort data in the input file ?

Hi,

One solution could be:

my @sorted_lines = map { $_->[1] } sort { $a->[0] <=> $b->[0] } map { [(substr $_,2,8) => $_] } <DATA>; __DATA__ 1&20070102&string3&string4.... 2&20070101&string3&string4.... 3&20061212&&string3&string4....

If your files are really big, then you could try another approach...

Regards,

fmerges at irc.freenode.net

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://599159]
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.