TIMTOWTDI, but here are two methods (grep and regex) to get you started:
#!/usr/bin/env perl use strict; use warnings; my @cases = qw/ABA SCO ACC PHC GHF/; my $re = join '|', @cases; for my $text ('SCO', 'Microsoft') { print "$text found (grep)\n" if grep {$text eq $_} @cases; print "$text found (regex)\n" if $text =~ /^$re$/; }
PS. It would be better not to use $a as a variable name since that is special with respect to sorting.
In reply to Re: Sparing multiple 'or's
by hippo
in thread Sparing multiple 'or's
by Denis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |