Doug McNutt wrote:
At 22:44 -0500 12/25/04, Lola Lee wrote:
Nothing happens. This lesson that I'm working on is working from the premise that people are using a Windows Perl installation.
Watch out for line ends in the source file that is being counted. Perl probably doesn't care because the return-linefeed pair from Windoze still contains the single linefeed that UNIX expects. But I have been fooled, especially with Unicode's two new code points representing line ends.
Also, I believe that the snippet suggested could stop if there is a blank line in the file! Although, it would still contain a linefeed, I rarely trust interpretation of such.
while (defined($line = <>))
I prefer this method: while ($line = <>) { next if ($line =~ /^\s*$/); }
-- cs