Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: sorting CSV files

by argupta (Initiate)
on Feb 05, 2009 at 22:43 UTC ( [id://741718]=note: print w/replies, xml ) Need Help??


in reply to Re: sorting CSV files
in thread sorting CSV files

Hello derby, Im working in a similar data sctructure. In my case the csv files are around 26Mb. And I want to sort them with reference to a particular column, and then taking a sorted group, i want to sort them again using a different column. Looking at your earlier solution, I am unable to sort them in a hash table. (Since that is the best way I can think of)

Replies are listed 'Best First'.
Re^3: sorting CSV files
by derby (Abbot) on Feb 05, 2009 at 23:12 UTC

    What hash? There's no hash there, just references to arrays. You can always do a secondary sort:

    foreach my $row ( sort { $a->[1] <=> $b->[1] || $a->[2] <=> $b->[2] } +@$sheet ) {
    That construct will sort first by second col and then by the third col.

    -derby

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-25 13:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found