my ($prop,$rank, $score); my ($prop2,$rank2, $score2); while (my($name1,$aref) = each %matrice ) { my $num=0; foreach my $item (@$aref){ $count_feat_trovate=0; ($prop,$rank, $score) = split(',',$item); my $lastrank=&lastrank2($name2,$prop); while (my($name2,$aref2) = each %matrice) { foreach my $item1 (@$aref2){ ($prop2,$rank2, $score2) = split(',',$item1); if($prop eq $prop2){ $count_feat_trovate++; #number of feat found $rank_trovato_2=$rank2; #Rank of which the feat has been found in regards to the second element } } } $last_rank_2=$rank2; } $last_rank_1=$rank; }