#!/usr/local/bin/perl use strict; use warnings; open (SORT1, "+>C:\\temp\\SORT.CSV") or die "Cannot open file $!\n"; my @sorted = map {$_->[0]} sort { $a->[6] cmp $b->[6] || $a->[2] cmp $b->[2] || $a->[5] cmp $b->[5] || $a->[9] <=> $b->[9]} map {chomp;[$_,split(/,/)]} ; foreach(@sorted) { printf SORT1 "$_\n"; } close (SORT1);