I would create a hash which keys would be the values the
user has selected. If there are double entries, some of
them will be overwritten. Just count how many keys your
hash has, and if it's less than 5, that means entries are
doubled (or tripled, or ...)
$entries{$INPUT{$_}} foreach (keys %INPUT);
if (%entries < 5) {
$error = "duplicate vote";
&error;
}