On Tue, 16 May 2000 14:04:24 -0500, "Cornish, Merrill"
<[EMAIL PROTECTED]> wrote:
>Ah ha! My feeble mind slowly begins to work. It wasn't
>
> while(<FILE>)
>
>that I got the warning about (since I never use that construct). Instead it
>was
>
> while($line = <FILE>)
>
>If you put in your own assignment, you lose the automatic protection of the
>bare <FILE>.
As I wrote in my previous post, this isn't true for 5.005 and later
either. 5.004 introduced the pesky warning about this and in 5.005 this
was "fixed" by providing the defined() test here too:
perl -MO=Deparse -e"while($a = <STDIN>){}"
while (defined($a = <STDIN>)) {
();
}
-e syntax OK
In practice it is almost impossible to get an empty string or a '0' string
back from readline() anyway. The two possibilities I remember are:
- Have a single '0' character at the end of a file without a trailing
newline.
- Use a tied filehandle that chomps() the string before returning it.
-Jan
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]