Solved

Difference between 5.005 and 5.003 builds

Posted on 1998-10-15
2
182 Views
Last Modified: 2010-03-05
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
0
Comment
Question by:paninaro
2 Comments
 
LVL 5

Accepted Solution

by:
b2pi earned 200 total points
ID: 1205349
1.) You're not alone; I've noticed this also, and so have (see 3b,
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)


0
 
LVL 84

Expert Comment

by:ozo
ID: 1205350
like the message says, test with defined:
  while ( defined($nextline=<INPFILE>) && ($nextline ne "EOR\n"))
(unless you actually want the loop to end if $nextline is "0")
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question