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.


In reply to Re: Multiple numeric not or compare in if statement by hippo
in thread Multiple numeric not or compare in if statement by RedJeep

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.