#!/usr/bin/perl my $sheet; my $count = -1; while( ) { chomp; $count++; # skip header next unless $count; my $row; @$row = split( /,/, $_ ); push @$sheet, $row; } foreach my $row ( sort { $a->[0] <=> $b->[0] || $a->[1] <=> $b->[1] } @$sheet ) { print join( ',', @$row ), "\n"; } __DATA__ Name,Score,State "001","67","CA" "2","67","CA" "12","63","FL" "1","72","IL" "1","32","AZ"