use warnings; use strict; my $flag_count = 0; while () { $flag_count++ while //g } print "flag_count = $flag_count\n"; __DATA__ foo bar goo boo __END__ flag_count = 3