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

Re: [MacPerl] Testing for Defined



At 14.48 -0500 1999.01.19, Richard Gordon wrote:
># Value of <HANDLE> construct can be "0"; test with defined().
>File '<AppleEvent>'; Line 11
># <AppleEvent> syntax OK
>
>The line that MacPerl is complaining about just says:
>
>while ($the_input = <INPUT>){

This warning is produced because the code could fail on the singular case
of the file ending on a single 0 without a newline following it.  I believe
that this has been fixed in future perls, so defined() is applied for you.

The syntax you want is this:

  while (defined($line = <FILE>)) {

defined() tests the result of the expression, which is the resulting value
of $line.

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

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