peterchan75
Supremacy Member
- Joined
- Apr 26, 2003
- Messages
- 6,719
- Reaction score
- 529
Hi All,
Need to search the first column of a 2D array and return the row index.
Possible to grep without using map ?
Need to search the first column of a 2D array and return the row index.
Code:
my @array = (['a','b','c'],['d','e','f'],['g','h','i']);
my @index = map { $_ -> [0] } @array;
my @result = grep { $index[$_] =~ /g/ } 0..$#index;
print @result;
Possible to grep without using map ?