I want to clarify something based on documentation from perlop:
while (my $line = <STDIN>) { 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 the line has a string value that would be treated as false by Perl; for example a "" or a "0" with no trailing newline.
So in this case the defined test doesn't need to be done explicitly, it's already being done implicitly.
Dave
In reply to Re^2: Matching against $_ behaves differently than matching against a named scalar?
by davido
in thread Matching against $_ behaves differently than matching against a named scalar?
by nysus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |