title: Check whether an array contains a value from another array
body: <p>I have an array of objects, and an array of acceptable return values for a particular method. How do I reduce the array of objects to only those whose method in question returns a value in my array of acceptable values?</p>
  
  <p>Right now, I have this:</p>
  
  <pre><code>my @allowed = grep {
      my $object = $_;
      my $returned = $object-&gt;method;
      grep {
          my $value = $_;
          $value eq $returned;
      } @acceptableValues;
  } @objects;
  </code></pre>
  
  <p>The problem is that this is a compound loop, which I'd like to avoid. This program is meant to scale to arbitrary sizes, and I want to minimize the number of iterations that are run.</p>
  
  <p>What's the best way to do this?</p>