1 1229.003932 1348.475942 2 1127.677089 1628.387836 3 1830.910815 686.226114 4 2181.269057 780.242484 5 2302.996066 850.572327 6 1201.169859 1107.266903 7 1266.842105 665.334403 8 1471.475049 644.755582 9 2278.018406 1909.274463 10 2616.853057 1779.732754 11 2730.703647 1697.259759 12 1608.323892 1555.214756 13 1719.087310 1988.052650 14 1924.751609 1987.482170 #### #!/usr/bin/perl use strict; use warnings; use Data::Dumper; my @data; my ($c, $i, $j); open ( DATA, "), scalar(), scalar() ); $c = $c + 3; # Remove the new-line from the end of the lines chomp @record; # Store a reference to this @record instance # in the @data array. push @data, \ @record; } my @sorted = sort { $a -> [1] <=> $b -> [1] } @data; print Dumper(@sorted); #for ($i = 0; $i < ($c); $i++) { # for ($j = 0; $j <= 2; $j++) { # print $sorted[$i][$j] ; # } #} #### $VAR1 = [ '2', '1127.677089', '1628.387836' ]; $VAR2 = [ '6', '1201.169859', '1107.266903' ]; $VAR3 = [ '1', '1229.003932', '1348.475942' ]; $VAR4 = [ '7', '1266.842105', '665.334403' ]; $VAR5 = [ '8', '1471.475049', '644.755582' ]; $VAR6 = [ '12', '1608.323892', '1555.214756' ]; $VAR7 = [ '13', '1719.087310', '1988.052650' ]; $VAR8 = [ '3', '1830.910815', '686.226114' ]; $VAR9 = [ '14', '1924.751609', '1987.482170' ]; $VAR10 = [ '4', '2181.269057', '780.242484' ]; $VAR11 = [ '9', '2278.018406', '1909.274463' ]; $VAR12 = [ '5', '2302.996066', '850.572327' ]; $VAR13 = [ '10', '2616.853057', '1779.732754' ]; $VAR14 = [ '11', '2730.703647', '1697.259759' ];