in reply to Re: Searching no. of times the pattern occurs in the data
in thread Searching no. of times the pattern occurs in the data
my $count = s/(?=$pat)//gsi;
If there are no capturing parentheses in the expression, you can simply use the match operator instead.
my $count = () = /$pat/gsi;
|
|---|