in reply to Re: Counting lines as I write them...
in thread Counting lines as I write them...
Regarding your pedant ...
(Note that the last line does not have a carriage return on it - so the last character in the file is '0'.)use strict; use warnings; use diagnostics; while (my $line = <DATA>) { print $line; } __DATA__ 0 1 2 3 0
Running this with perl 5.8.6 seems to net me all 5 lines (and no carriage return on the last line, leaving my prompt shifted over by one). perlsyn refers to this behaviour (i.e., while implicitly checking definedness rather than truth for file reads) rather off-the-cuff in its examples, but I'm having a hard time finding where this is explicit.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Counting lines as I write them...
by Fletch (Bishop) on Apr 11, 2005 at 15:43 UTC |