glemley8 has asked for the wisdom of the Perl Monks concerning the following question:
open (SOURCE, "<src_data.csv") or die "Can't open file"; open (OUTPUT, ">output_data.csv") or die "Can't create load file"; my $sheet; my $count = -1; my $csv = Text::CSV->new ({binary=>1}) or die "Cannot use CSV: ".Text: +:CSV->error_diag (); my @rows = (); while (my $row = $csv->getline(*SOURCE)){ push @rows, $row; } my $header = shift @rows; foreach my $row (sort {$a->[1] cmp $b->[1]} @rows){ print OUTPUT join(',', @$row), "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sorting script deletes first line of data
by philiprbrenan (Monk) on Aug 28, 2012 at 17:18 UTC | |
by glemley8 (Acolyte) on Aug 28, 2012 at 17:30 UTC |