in reply to Re: Answer: how do i find the index of a specific array value?
in thread How do I find the index of a specific array value?

grep $array$_ eq $search_for, 0 .. $#array; will return matched array which stores the index of the matching words. my @index_arr = grep {$array$_ eq $search_for} 0 .. $#array; or my @index_arr = grep $array$_ eq $search_for, 0 .. $#array; foreach (@index_arr) { print "matching position = $_\n"; }
  • Comment on Re^2: Answer: how do i find the index of a specific array value?