Are you maybe looking for something like this?
use v5.12; use List::Util qw(sum); my @dipept = qw( AABBCC AABBAA ); my $count = sum map { scalar(my @r = /AA/g) } @dipept; say $count;
(Outputs 3, because "AA" occurs three times in @dipept; once in the first string, twice in the second.)
In reply to Re: Using grep in a scalar context
by tobyink
in thread Using grep in a scalar context
by newbie1991
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |