http://qs321.pair.com?node_id=11118797


in reply to Multiple numeric not or compare in if statement

You have good answers already so I'll merely point out 2 things which might make things a little easier for you in general.

Did you know that the || operator has lower precedence than either == or !=? This means that all your inner brackets can go and you can write your conditionals like this:

if ($a == 3 || $a == 77 || $a == 8)

Further, since not has lower precedence than && you could even write the negated one as

if (not $a != 3 && $a != 77 && $a != 8)

Finally, $a and $b are special variables (see perlvar) which means that you would be best to avoid them even in an SSCCE. I'd recommend starting from the other end of the alphabet if you want to use single-character names.