I want to find an element in an array. What I want to get from this search is all the indexes of the array where I find a match.
So, for example, the word I want to find is:
$myWord = cat
@allMyWords = my whole file with multiple occurrences of cat in random positions in file
So, if a cat is found at the 3rd, 19th and 110th positions, I want to get these indices as a result of this. I was wondering if there is a small and easy way to do this.
Thank!
source
share