Moin, moin!
Hier eine Lösung, die sicher nicht optimal ist:
Ersetze den zu zählenden String durch sich selbst! Dabei wird die Anzahl der Fundstellen zurückgegeben.
$teststring="Most of this section is related to use of regular expressions from Perl. Such a use may be considered from two points of view: Perl handles a a string and a ``pattern'' to RE (regular expression) engine to match, RE engine finds (or does not find) the match, and Perl uses the findings of RE engine for its operation, possibly asking the engine for other matches.";
$searchstring="of";
$count=$teststring=~s/($searchstring)/$1/g;
Norbert