Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Difference between 5.005 and 5.003 builds

Posted on 1998-10-15
2
Medium Priority
?
217 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 400 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 85

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
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…
Six Sigma Control Plans

972 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