Here is a start. The regular expression gets the size of the array returned by the regular expression, which uses () to enclose the text to be searched for and /g to find all the occurences.
use feature ":5.14"; use warnings FATAL => qw(all); use strict; my $h = "aaa bbb ccc aaa aaa"; say scalar (() = $h=~m(aaa)g);
Produces
3
In reply to Re: how to to find the "/" in a string
by philiprbrenan
in thread how to to find the "/" in a string
by robertw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |