my @matches = grep { $_ =~ /aa/i } @array; print "Matched:$_\n" for @matches; #### print "Matched:$_\n" for grep { $_ =~ /aa/i } @array;