No need for a loop. Try this:
my %check; @check{@arr) = (1) x @arr;
You now have a hash %check which has a key/value pair for each element in the list. You can check for the existance of value, $val, by doing:
if $check{$val}
In reply to RE: Determining if an element is already in an array.
by davorg
in thread Determining if an element is already in an array.
by ithron
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |