#!/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] ; # } #}