You want grep
die "bla bla\n" unless grep { $_ eq $name } @array
Or if you want to avoid the overhead of looking at the whole array look at first() in List::Util.
s/if/unless/ - thanks frodo72
In reply to Re: searching an array
by adrianh
in thread searching an array
by jeanluca
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |