use strict; my $count = 0; while( ) { print; ++$count while m[the]ig; } print "'the' appeared $count times in 'theFile'\n"; __DATA__ THis is the dawning of the age of Aquarius. Good morning Starshine, the earth says hello. The end.