-{% highlight perl6 tio=https://tio.run/##K0gtyjH7/7@4NEkhOb80r0QXyCouKcrMS1fQUIEwdBRUgIK6EI6mQjUXZ2pOam6xAlRaoa5OIdcqv0wfSZU@V@1/NOM0VLQ8/fTSU0uAxkFZmnrFiZX/HZ2cXYCQC4gB %}
+{% highlight perl6
+tio=https://tio.run/##K0gtyjH7/7@4NEkhOb80r0QXyCouKcrMS1fQUIEwdBRUgIK6EI6mQjUXZ2pOam6xAlRaoa5OIdcqvwxoUGKBPpJSfa7a/2hmaqhoefrppaeWAM2EsjT1ihMr/zs6ObsAIRcQAwA %}
sub count-substring ($string, $sub-string) {
elems $string ~~ m:overlap/$sub-string/
}
@@ -269,8 +270,8 @@ sub count-substring ($string, $sub-string) {
{% markdown %}
The Perl 6 version makes use of some regex magic, and the `elems` subroutine.
`elems` returns the number of elements in a list, which in this case would be
-the number of matches found by the regex. The `m:ov//` makes a regex to
-*m*atch, with *ov*erlapping strings.
+the number of matches found by the regex. The `m:overlap//` makes a regex to
+*m*atch, with *overlap*ping strings.
{% endmarkdown %}
--
cgit v1.1