++ For the hash method, although your nested structure makes it look more complex than the other solutions. It can be made to look much simpler using a single level, and the fact that there won't be autovivification in boolean context:
# equivalent to %is_valid = (ABA => 1, SCO => 1, ACC => 1...); my %is_valid = map { $_ => 1 } qw( ABA SCO ACC PHC GHF ); if ($is_valid{$variable}) # Easy to read { ... }
In reply to Re^2: Sparing multiple 'or's
by Eily
in thread Sparing multiple 'or's
by Denis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |