Let's say I have this list:
my @list = qw(one two three four five);
and I want to grab all the elements containing o
. I'd have this:
my @containing_o = grep { /o/ } @list;
But what would I have to do to also receive an index, or to be able to access the index in grep
's body?