In an oversight since corrected, I neglected to mention that the code here was run under Perl version 5.8.9.
I tried
with my original __DATA__ both with and without a newline after the 0 on the final line and with strictures and warnings fully enabled and under 5.8.9 and saw no difference in behavior (and no warnings). The reason is easy to see from a deparse:while (my $line = <DATA>) { print $line; }
The defined test is automatically added.c:\@Work\Perl\monks\Marshall>perl -MO=Deparse,-p t_read_DATA_2.pl use warnings; use strict 'refs'; print("perl version: $] \n\n"); while (defined((my $line = <DATA>))) { do { print($line) }; } __DATA__ line the first second line penultimate line is line 3 t_read_DATA_2.pl syntax OK 0
Give a man a fish: <%-{-{-{-<
In reply to Re^6: how do I "initialize" $_
by AnomalousMonk
in thread how do I "initialize" $_
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |