mayank2211 has asked for the wisdom of the Perl Monks concerning the following question:
Hi All, I have a requirement in perl where i want to verify that the input value matches from any of the values in a array variable. can you please suggest how to achieve this. Please Find Below a sample code.
my $input_val = 'abc'; @names = ("abc", "def", "ijk"); if($input_val eq @names) {print "Match Found";} else { print "Match Failed";}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: if Loop with array
by toolic (Bishop) on Jun 11, 2015 at 16:20 UTC | |
by Anonymous Monk on Jun 15, 2015 at 10:22 UTC | |
|
Re: if Loop with array
by ikegami (Patriarch) on Jun 11, 2015 at 16:19 UTC |