in reply to if Loop with array
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):
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: if Loop with array
by Anonymous Monk on Jun 15, 2015 at 10:22 UTC |