- or download this
while (<FILE>) {
$count += () = m/foo/g
}
print $count;
- or download this
while (<FILE>) {
while (/foo/g) {
...
print "$count so far.\n";
}
}
- or download this
my $count;
while (<FILE>) {
if ( $count += s/foo/foo/g ) { print "$count so far\n" )
}