In an oversight since corrected, I neglected to mention that the code here was run under Perl version 5.8.9.

I tried

while (my $line = <DATA>) { print $line; }
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:
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
The defined test is automatically added.


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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.