#!/usr/bin/perl use warnings; use strict; my @results; for (1..40){ my $hit = int rand(30); my $id = int rand(1000); push @results, [$hit, $id]; } my @search_results = sort { $b->[0] <=> $a->[0] } @results; print $_->[0], "\t", $_->[1], $/ for @search_results #### #Records my @Record; push @Record, int rand(100) for (0..999); #### #!/usr/bin/perl use warnings; use strict; #Search Results my @results; push @results, [int rand(30), int rand(1000)] for (1..40); #Records my @Record; push @Record, int rand(100) for (0..999); #Display print "hits\t ID\t Data\n"; for (sort { $b->[0] <=> $a->[0] } @results) { print "$_->[0] \t $_->[1] \t $Record[$_->[0]]\n"; } #### # this bit is untested, 'tis bedtime for me open DATA, "$id_file" or die "something useful"; foreach $id sort ($b->[1] <=> $a->[1] } @results) { # read file until $_ (the ID) is found while () {next unless /^$id->[1]/} # If you want to use it later # $record_hash{$_)=+(split /your_sep/)[1] # or just print the record my $record=+(split /your_sep/)[1] print "$_->[0] \t $_->[1] \t $Record\n"; } # goodnight.