title: Why doesn't my Perl grep return the first match?
body: <p>The following snippet searches for the index of the first occurrence of a value in an array.  However, when the parentheses around $index are removed, it does not function correctly. What am I doing wrong?</p>
  
  <pre><code>my ($index) = grep { $array[$_] eq $search_for } 0..$#array;
  </code></pre>