[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] File Handle Error in New MacPerl



You probably should do while(defined($line = <IMAGES>)) {...} instead.

Here's what perldiag has to say about the error message:
--
	Value of %s can be "0"; test with defined()	

		(W) In a conditional expression, you used <HANDLE>, <*> (glob), each(), or readdir() as a boolean value.  Each of these constructs can return a value of "0"; that would make the conditional expression false, which is probably not what you intended.  When using these constructs in conditional expressions, test their values with the defined operator.
--

Also read about the <> operator in perlop. I don't know why this warning would suddenly turn up with the new MacPerl. It shouldn't if you havn't made any change to your script. (such as adding #!perl -w)

 Xah, xah@best.com
 http://www.best.com/~xah/Wallpaper_dir/c0_WallPaper.html
 "New Programing Paradigm: Parallel execution of bugs and C/C++ programers."

At 11:41 AM -0800 1998.01.01, Richard Rathe wrote:
>I downloaded the new MacPerl and suddenly I see this error message in
>several of my scripts:
>
>  # Value of <HANDLE> construct can be "0"; test with defined().
>  File ':mtxextra.pl'; Line 113
>..
>I thought 'while($line =<IMAGES>)' was a legitimate way to read a
> file a line at a time until the end. I am using the -w flag.



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch