while () { # do stuff } # terminates if we get a line that evaluates to false. while (my $l = ) { # do stuff } # only terminates at end of file (or error reading file) while (defined(my $l = )) { # do stuff } # Let's take advantage of $_ and be somewhat safe(r). { local $_; while () { # do stuff } }