That really depends. If @ARRAY is only a couple of elements, you're fine:
$x = 3; $y = 7; @array = ( 0, 3, 7 ); if ( grep { $_ == $x } @array and grep { $_ == $y } @array ) { print "Good\n"; } else { print "Bad\n" }
However, if your array is sizable (or if you are iterating over this construct, using grep is not a good idea. grep forces you to check every value in @ARRAY, but a foreach loop can be exited as soon as a match is found, thus being more efficient.

Update: I tossed this code out quickly, so I realize that I may not have gotten the full intent of what you wanted. You mentioned three arg values (I missed that at first), but then went on to state that there are things you want to do if the first two args evaluate as true. Is the third arg value even relevant to your question? I'm missing something here. If it's not relevant, then I think my snippet answers your question. Otherwise, could you clarify?

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just go the the link and check out our stats.


In reply to (Ovid) Re: comparing multiple arg values against multiple files by Ovid
in thread comparing multiple arg values against multiple files by dallok

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.