#! C:\Programme\Perl\bin\ use warnings; use strict; our $count=0; our $teststring="Long test string \n that includes the word we search, which is test (to test it)\n several times in one line like this: test test test"; our $residual=$teststring; while ($residual) { if ($residual=~"test") { $residual=$_; $count++; } } print $count;