Personally, I'd use a hash:
my %expr = (
EX_CASE1 => { map { $_ => 1 } qw( ABA SCO ACC PHC GHF ) },
EX_CASE2 => {}, # …
);
:
:
if (exists $expr{EX_CASE1}{$a}) {
...
}
:
if (exists $expr{EX_CASE2}{$b}) {
...
}
but I'd choose more expressive names than EX_CASE1 etc :)
You can also use List::Util's any, but that might read fine, but is very hard to optimize, so it will probably be slower the your current code
use List::Util qw( any );
if (any { $a eq $_ } qw( ABA SCO ACC PHC GHF )) {
....
}
Enjoy, Have FUN! H.Merijn