Solved

Difference between 5.005 and 5.003 builds

Posted on 1998-10-15
2
209 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
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…
Six Sigma Control Plans

617 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