I'm working on a perl assignment, that has three arrays - @array_A, @array_B and array_C with some values in it, I grep for a string "CAT" on array A and fetching its indices too
my @index = grep { $@array_A[$_] =~ 'CAT' } 0..$#array_A;
print "Index : @index\n";
Output: Index : 2 5
I have to take this as an input and check the value of other two arrays at indices 2 and 5 and print it to a file. Trick is the position of the string - "CAT" varies. (Index might be 5 , 7 and 9)
I'm not quite getting the logic here , looking for some help with the logic.
@array_A?my @index = …line or are you struggling with applying the result,(2, 5), to@array_Band@array_C?