while () { while (/foo/g) { $count++; print "$count so far.\n"; } }