## This function takes the array as parameter ## Returns the array that contains the unique elements sub remove_duplicate_from_array{ my @lists = @_; ## The array holds all the unique elements from list my @list_unique = (); ## Initial checker to remove duplicate my $checker = -12345645312; ## For each sorted elements from the array foreach my $list( sort( @lists ) ){ ## move to next element if same if($checker == $list){ next; } ## replace old one with new found value else{ $checker = $list; push( @list_unique, $checker); } } ## Finally returns the array that contains unique elements return @list_unique; } #### if($checker == $list){ #### $checker =~ /^([^\t]*\t[^\t]*)/; $checker_part = $1; $list =~ /^([^\t]*\t[^\t]*)/; $list_part = $1; if($checker_part == $list_part){