use warnings; use strict; my $input_val = 'abc'; my @names = ("abc", "def", "ijk"); if (grep { $input_val eq $_ } @names) {print "Match Found";} else { print "Match Failed";} print "\n";
See also (for potentially faster look-ups):
In reply to Re: if Loop with array
by toolic
in thread if Loop with array
by mayank2211
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |