while (<$fh> && ! eof($fh)){ unless ($_) { update_status; next; } #process input... }