title: perl Get indexes of matches in array
body: <p>I want to search for an element in an array. What I want to get from this search is the all the indices of the array where I find a match.</p>
  
  <p>So, for example the word I want to search is :</p>
  
  <pre><code>$myWord = cat
  
  @allMyWords = my whole file with multiple occurrences of cat in random positions in file
  </code></pre>
  
  <p>So, if cat occurs at 3rd, 19th and 110th position, I want those indices as a result of it. I was wondering if there is a small and simple method to do this. </p>
  
  <p>Thanks!</p>