my $count; while (<DATA>) { s/(this)/$count++;$1/ge; # non-destructive version } print "number of this = $count\n";
In reply to Re: counting matches in a line
by pc88mxer
in thread counting matches in a line
by halfcountplus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |