http://www.perlmonks.org?node_id=817035

#!/bin/perl -w use strict; my $file1 = "../../../180_top_height_snps_annotatedwextra.afrd.efrd.al +l.lsrd.txt"; my $file2 = "../../../EXETER-HEIGHT-ALL-MAC3-20091217-stderr.1.rsIDsal +l.nor2.ma.afrd.efrd.lsrd.tbl"; my @badones; my @array1; my %hash2; open (INPUT1, $file1) || die "Cannot open $file1"; while (<INPUT1>) { my @infoparse = split(/\s+/); chomp (@infoparse); push (@array1, \@infoparse); } close(INPUT1); @array1 = sort {$array1[$a]->[3] <=> $array1[$b]->[3]} (@array1);