Mr. Shawn H. Corey wrote:
On Sun, 2008-11-23 at 05:47 -0800, John W. Krahn wrote:
Mr. Shawn H. Corey wrote:
On Sun, 2008-11-23 at 05:34 -0800, John W. Krahn wrote:
You shouldn't "do something with $line" if $bytes_read is undefined:

while ( my $bytes_read = read PATTERN, $line, 1920 ) {
     unless ( defined $bytes_read ) {
         die "error reading $filename: $!";
         }
     # do something with $line
     }
undef is false.
Yes it is.  And your question is ...?

Your while loop will exit before your test for defined.  Your code will
never report an error.

Yes, thank you for the correction.


John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to