( ++$hash{$_} < 3 or die "too many matched elements" ) for (@array);