grep {$_ ne $elemnt} @value
In this context, this means "count how many elements in @values don't equal $element". When @values is initially empty, this will always be zero and therefore false. See the Basic debugging checklist, adding prints of things like @values and the condition in the loop will be helpful, especially with Data::Dumper. I suspect you meant not grep {$_ eq $elemnt} @values instead, however, this will be inefficient for larger arrays, and as GrandFather already said, the typical solution is to use a hash. See also How can I remove duplicate elements from a list or array?
In reply to Re: Finding unique elements in inputs
by haukex
in thread Finding unique elements in inputs
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |