in reply to Re^3: Find number of short words in long word
in thread Find number of short words in long word

No need to split the string-to-be-searched-for up into first character/rest of the characters if the capture group is wrapped in a look-ahead.
>perl -wMstrict -le "my $string = 'aBrabRabrAbra'; my $pattern = qr{ brabra }xmsi; my $count =()= $string =~ m{ (?= ($pattern)) }xmsg; print $count; my @matches = $string =~ m{ (?= ($pattern)) }xmsg; print qq{@matches}; " 3 BrabRa bRabrA brAbra