You can either use grep like this: if (grep {$variable eq $_} qw( ABA SCO ACC PHC GHF )) (where qw builds a list of words).
Or use List::Util's any (with its more intuitive name, and slightly faster since it will stop searching as soon as a match is found):
use List::Util qw( any ); if (any {$variable eq $_} qw( ABA SCO ACC PHC GHF ))
$a is a special variable, than can be used by sort or some functions of List::Util, that's why I used $variable instead.
And also note that I used eq, which compares two strings, while == compares numbers. Perl will actually complain about this if you have warnings enabled (which you really should, as it lets perl tell you where it thinks you have done a mistake, and it is often right).
In reply to Re: Sparing multiple 'or's
by Eily
in thread Sparing multiple 'or's
by Denis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |