![]() |
|
good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Re: Re: question about $_ and eofby strat (Canon) |
on Mar 13, 2002 at 12:36 UTC ( #151356=note: print w/replies, xml ) | Need Help?? |
> A: <STDIN> is returning a newline character '\n', which > is true. In practice, regardless of O/S, you never get > the empty string or a bare 0, hence the only false value > you encounter is undef. I think, the construct while (<STDIN>) { is just another way to write: while (defined ($_ = <STDIN>)){, not only for while ($_ = <STDIN>) {. The difference is not big; only if there is a 0 (=zero) on the last line of a file without \n, it can become essential. But with pure STDIN this case might never happen, only with files or the like...
Best regards,
In Section
Seekers of Perl Wisdom
|
|