my $rec_count=0; while (<>) { $rec_count++; print STDERR "rec=$rec_count\n" if ($rec_count%1000==0); .... }