test(); sub test { $count = 0; $count++ while (<>); print "COUNT = $count"; while (<>) { chomp; print $_."\n"; } }