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