in reply to Help Sorting a CSV File

If you're doing a lot of CSV stuff you probably want to look at DBD::CSV.
use DBI; use 5.014; use warnings; # See "Creating database handle" below my $dbh = DBI->connect ("dbi:CSV:", undef, undef, { f_ext => ".csv/r", RaiseError => 1, }) or die "Cannot connect: $DBI::errstr"; my $sth=$dbh->prepare("select * from data order by SUPPLIER_CODE;"); $sth->execute(); local $"=q{,}; while (my $values_aref=$sth->fetchrow_arrayref ) { #warn Data::Dumper->Dump([\$values_aref],[qw(*values)]),' '; print "@$values_aref\n"; };