in reply to How do I sort a CSV file on multiple columns?

Text::CSV is a module for writing and reading CSV data. If you want to sort the results, you have two choices in my mind (and I'm sure a host of others):
  1. You can slurp the file into some data structure - probably a list of lists (perllol) - and then sort the results, a la:

    #!/usr/bin/perl use strict; use warnings; my @lists = ([0,7,0], [1,3,0], [0,5,1], [1,2,1]); foreach my $list (sort {$a->[0] <=> $b->[0] or $a->[2] <=> $b->[2] } @ +lists) { print @$list, "\n"; }
  2. You can use a module that has the support you require. I like this idea better, using DBI and DBD::CSV. An example can be found at DBD::CSV.