Jason, I would like to just re-state what I wrote (see this very text below)
>>>... last line contains zero, AND(!!!) has no >>>EOL (\n) at the end. Not having "\n" at the end is only possible for the last line in the file. (Aside from you modifying $/). But anyway, I guess, the discussion boils down to the fact that now you do not have to check for the defined(). Eugene Haimov. -----Original Message----- From: King, Jason G [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 23, 2003 7:03 PM To: [EMAIL PROTECTED] Subject: RE: matching expressions in files. Eugene writes.. >The way to get a line that fails the condition from >a text file is when you read a file like: > >sdfsdfs >sdfsdfsd >0 > >The last line above contains zero, AND(!!!) has no >EOL (\n) at the end. > >But guess what, > while ( $Line=<FILE> ) >still gets it! Even if I was right and $Line = <FILE> was evaluated 'normally' it would still have succeeded because $Line would have contained "0\n" which is true in Perl. But... >I tried it myself, and concluded that it must be some "magic" in the "while". This is correct anyway, there is magic in the while. Sorry for the misinformation - I think this must be something new because you definitely USED to have to put defined in there. Sorry again. >Because when you try: > >$Line = <FILE>; >REPEAT: >if ( $Line ) >{ > # do something > $Line = <FILE>; > goto REPEAT; >} > >...then it DOES NOT get to process the "0". I'd be very surprised at that! It processes the "0" for me (because it's actually a "0\n" which is true). Are you sure you didn't chomp $Line or something? chomp( $Line = <FILE> ); Because it will not process "0" then. -- Jason King _______________________________________________ ActivePerl mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ ActivePerl mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
