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. -- Just my 0.00000002 million dollars worth, Shawn The map is not the territory, the dossier is not the person, the model is not reality, and the universe is indifferent to your beliefs. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/