my @matches = grep { $_ =~ /aa/i } @array; print "Matched:$_\n" for @matches;
Since the nature of the question itself clearly shows that the OP is a complete newbie, I think it may be worth to add that it's not necessary to pass through an intermediate @matches variable (before he cargo cults such an use), although in other cases it could, and in some others it may be convenient anyway:
print "Matched:$_\n" for grep { $_ =~ /aa/i } @array;
But wait! Here you have two loops, of which one implicit in grep, whereas one would suffice. Hence a solution like that of fenLisesi may be preferable, but (to the OP!) be warned that it doesn't really matter in terms of performance.
In reply to Re^2: how to get the full array value if part of the element matches
by blazar
in thread how to get the full array value if part of the element matches
by greatshots
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |