while (<DATA>) { if ($_ =~ /this/) { my $c=the number of times "this" occured print "$_\nthis matched: $c times" } } [download]
In reply to counting matches in a line by halfcountplus