my $count = 0; ++$count while ( $parent =~ /$substring/go ); #### mclapdawg:829841 juster$ perl -E 'say scalar split /xxx/, q{xxx xxx }' 3 mclapdawg:829841 juster$ perl -E 'say scalar split /xxx/, q{xxx xxx}' 2