Thanks Ron, Earlier, I had misinterpreted the warning and tested the value of the file handle variable, to no avail.
I would not have thought of the case you mentioned. Here is a test. Things happen just as you said. 1. use strict; $\ = "\n"; 2. my ($fil,$lin) = 'peru'; 3. open OUT,">$fil"; 4. {local $\; print OUT 0}; # only digit zero, no \n 5. close OUT; 6. open IN,$fil; 7. print '1: ',tell IN; 8. $lin = <IN> or print "2: nil"; 9. print '3: ',$lin; 10. print '4: ',tell IN; 11. open IN,$fil; 12. defined($lin = <IN>) or print "5: nil"; 13. print '6: ',defined $lin? $lin: "undef"; 14. open IN,$fil; 15. print 9,<IN>,9; 16. __END__ Value of <HANDLE> construct can be "0"; test with defined() at ./bits.pl line 8. 1: 0 2: nil 3: 0 4: 1 6: 0 909 Best - - On Wed, 14 Apr 2004 12:43:17 -0400, Ronald J Kimball wrote: >What's wrong with the statements is exactly what the warnings are telling you! Value of <HANDLE> construct can be "0"; test with defined() at qlib.pm line 25. If the last line of a file is the single character 0 (not followed by a newline), then a boolean test will incorrectly suggest that no data was read from HANDLE. Thus, you should test with defined() instead. You get these warnings even when that block of code is not executed because these are syntax warnings that are generated at compile time. You probably want something like: defined($var = <HANDLE>) or last;