2. fastif( grep{$test eq $_} @array ){ # }
You can use '==' instead of 'eq' if the elements are numericforeach (@array) { next unless $_ eq $test; #here is a match # ... last; }
my %test @test{@array} = (); foreach (@many_test_values) { if (exists $test{$_}) { # here is a match } }
In reply to Re: testing against an array
by ccn
in thread testing against an array
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |