I have recently upgraded from using Activestate's Perl for Win32 (based on Perl 5.003_07) to their Active Perl (based on 5.005_02 built for MSWin32-x86-object) and have found that the loops which start with:
while (($nextline=<INPFILE>) && ($nextline ne "EOR\n"))
{
# blah, blah
}
now throw up the warning
Value of <HANDLE> construct can be "0"; test with defined() at...
Is there anything actually wrong with the line (I have yet to have any run-time problem with the line) or is there a way to rewrite which won't throw up a warning.
Thanks
Matt Freake
below) have many others.
2.) Simplest case you'll get the message on:
use strict;
my($line);
open(FIL, "somefilehere");
while($line = <FIL>) {
yada, yada
}
will give the message as described.
3.) Two ways of getting around it:
3a.)
use strict;
my($line);
open(FIL, "somefilehere");
while(<FIL>) {
$line = $_;
yada, yada
}
3b.) Upgrade your perl!!! With the standard version 5.005_02, the
error goes away (I don't use the active state stuff, so I can't tell
you what the case is). Unless you really need the object stuff, it's
probably best not to be using it in production in any case (same for
threads, IMHO)