my $str = "There are three theatres in the town"; my $count = () = $str =~ m/(\bthe\b)/ig; print $count;