To get the index of elements in fields containing /, I use the following but get an error msg:
@ind = grep($fields[$_] =~ /\/\/]);
Search pattern not terminated
For the sake of completeness, here's how it should look like (if array in question is @fields variable):
my @slash_indexes = grep { $fields[$_] =~ m~/~ } 0..$#fields;
Demo. The code given in the question misses the second param of grep - the list that should be grepped. Considering you need to collect indexes, you need to pass indexes of the original array into grep as well, and not the array itself.
grep { $fields[$_] =~ m~/~ && $fields[$_] ne '0/0' }.You are escaping the / that should terminate your regular expression.
Just remove the last \ from before it.
=~ m#/# is more readable than =~ /\//.
grepshould have two parameters, not one: what list are you grepping?