in reply to Duplicate entries?

perldoc -q duplicate
How can I remove duplicate elements from a list or array?

Replies are listed 'Best First'.
Re^2: Duplicate entries?
by bdalzell (Sexton) on Jan 11, 2012 at 23:39 UTC
    this subroutine will sort the list of genes if you have put them into an array where each gene (or line containing the gene) is an element of the array and where each duplicated entry is of the same format.
    sub findDupsInArray { my @array =(@_); @array = sort{$a cmp $b} @array; my $previtem; foreach my $item (@array){ if($item ne $previtem ) { push (@dups,$previtem); }#if $previtem = $item; }#foreach return @dups; }
    Alternatively you can make the whole list a hash where gene name is the key and gene description is the value. then export the hash since the hash will not allow duplicated keys.