Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Difference between 5.005 and 5.003 builds

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 …
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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

704 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