while (my $line = ) { &do_something_with($line); } #### while (defined(my $line = )) { &do_something_with($line); } #### The following lines are equivalent: while (defined($_ = )) { print; } while ($_ = ) { print; } while () { print; } for (;;) { print; } print while defined($_ = ); print while ($_ = ); print while ; This also behaves similarly, but avoids $_ : while (my $line = ) { print $line } In these loop constructs, the assigned value (whether assignment is automatic or explicit) is then tested to see whether it is defined. The defined test avoids problems where line has a string value that would be treated as false by Perl, for example a "" or a "0" with no trailing newline. If you really mean for such values to terminate the loop, they should be tested for explicitly: while (($_ = ) ne '0') { ... } while () { last unless $_; ... }