in reply to weird array processing question

I don't know of an existing function, and my reduce-fu is weak. But, the 1st thing that comes to mind is a hash with grep:
use warnings; use strict; my %uniq; $uniq{$_}++ for (1 , 2, 3 , 4 , 1, 2, 3); my $matches = grep { $_ > 1 } values %uniq; die "Walrus Festival!" if $matches > 2;

Update: replaced keys with values