On 6/29/05, Michael G Schwern <[EMAIL PROTECTED]> wrote:
> On Tue, Jun 28, 2005 at 06:25:31PM -0000, Justin Mason wrote:
> > However, there is one key difference: "while (<$io>)" and "while
> > ($io->getline)" ha ve different behaviour.    If the last line of an input 
> > file
> > contains "0" (with no trailing newline), "while (<$io>)" will read it and
> > perform an iteration of the while loop, but "while ($io->getline)" will read
> > it, consider it a false value, and instead break out of the while loop.
> 
> Confirmed.  while(<FH>) must have some sort of special case to consider
> "0" true to avoid this sort of gotcha.

while (<FH>) {

is documented to be equivelent to

while (defined($_=<FH>)) {

in perlvar I/O Operators.



-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Reply via email to