use 5.18.2; use warnings; use Data::Peek; use Text::CSV_XS qw( csv ); my $aoa = csv (in => "test.csv", escape => undef, allow_loose_quotes => 1); csv (in => [ sort { $a->[30] <=> $b->[30] || $a->[0] <=> $b->[0] || $a->[1] <=> $b->[1] } @$aoa ]);