Count occurrences of a substring
The :r
adverb makes the regex "ratchet forward" and skip any overlapping matches. .comb
- when given a Regex
as an argument - returns instances of that substring. Also, prefix +
forces numeric context in Raku (it's a no-op in Perl 5). For the built in listy types that is the same as calling .elems
method. One other style point: we now tend to prefer hyphenated names over camelCase.
Last updated