in reply to sort and hash

Ids are the unique part right? So for your hash you would have keys being the sequence ID and the scores are the value so you just want to sort based on the value in the hash rather than the id.
my %sequences = ( 'geneA' => 100, 'geneB' => 105, 'geneC' => 65 ); # sort by score, highest to lowest for my $id ( sort { $sequences{$b} <=> $sequences{$a} } keys %sequences ) { print "$id $sequences{$id}\n"; } # of course you can always add in more sequences $sequences{'catA'} = 75; # if you just want the sorted list of IDs my @ids = sort { $sequences{$b} <=> $sequences{$a} } keys %sequences;