in reply to weird array processing question

From your example array it looks like you mean you want to find out if there are 3 duplicated elements in the array. You have 1,2,3 showing up twice. An easy way to do that is to make a hash using the array elements as the keys and increment the hash value for each key as seen. This shows up in the source code for List::Compare as a 'seen' hash.

my %seen; $seen{$_}++ foreach @array_whatsit;

Then count the number of keys in the hash with hash values greater than one.

my @duplicates = grep {$_ if $seen{$_}>1} keys %seen; print "There are ", @duplicates+0, " duplicates.\n";