use strict; use warnings; my @list = ( [qw(1.000 64.103 2840.0)], [qw(1.000 42.735 2840.0)], [qw(1.000 32.051 2840.0)], [qw(1.050 64.103 3280.0)], [qw(1.050 42.735 3280.0)], [qw(1.050 32.051 3280.0)], [qw(1.100 64.103 3720.0)], [qw(1.100 42.735 3720.0)], [qw(1.100 32.051 3720.0)] ); my @sorted = sort { $b->[1] <=> $a->[1] # 2nd col (biggest first) || $a->[0] <=> $b->[0] # 1st col (lowest first) } @list; foreach(@sorted) { print join("\t", @{$_}),"\n"; } __END__ Output: 1.000 64.103 2840.0 1.050 64.103 3280.0 1.100 64.103 3720.0 1.000 42.735 2840.0 1.050 42.735 3280.0 1.100 42.735 3720.0 1.000 32.051 2840.0 1.050 32.051 3280.0 1.100 32.051 3720.0