in reply to Re: Re: Re: Re: Re: advice for reading data from a file
in thread advice for reading data from a file

Actually, it's not just me. The perlop man page (way down in the section on "I/O Operators") says:
The following lines are equivalent: while (defined($_ = <STDIN>)) { print; } while ($_ = <STDIN>) { print; } while (<STDIN>) { print; } for (;<STDIN>;) { print; } print while defined($_ = <STDIN>); print while ($_ = <STDIN>); print while <STDIN>;

Replies are listed 'Best First'.
Re: Re:^nth advice for reading data from a file
by Roger (Parson) on Jan 19, 2004 at 04:06 UTC
    Yes you are quite right. I tried the following script and I am convienced. I have mixed it up with looping through array elements the other day, where I was caught by the '0' gotcha' and became a bit paranoid.
    use strict; use warnings; while (<DATA>) { print; } __DATA__ 0 1 2 3