you will get a warning if you don't have the while (defined (my $line =<DATA>)){} syntax, that is because a line with just "0" could evaluate to "false". On "real file handles" the action is a bit different
Sorry, but no, DATA is a real filehandle, there shouldn't be any differences. And in regards to this "Perl has changed how it deals with <DATA>", I can't verify that, the defined check seems to be implicit all the way back to Perl 5.6 (I haven't had a chance to look at older versions). And I haven't been able to produce a warning either, or get while (<DATA>) or while (my $line=<DATA>) to evaluate a line containing only 0 (no newline) as false, on 5.6 thru 5.28. Interestingly, the implicit defined check wasn't actually documented in detail until recently (5e979393c).
In reply to Re^4: how do I "initialize" $_
by haukex
in thread how do I "initialize" $_
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |