John W. Krahn wrote:
In perl you almost *never* need to use the eof() function. That is
usually written as:
while ( read IN, $buffer, $blksize )
{
But even that doesn't report any errors that read() may encounter.
while ( my $read = read IN, $buffer, $blksize )
{
defined $read or die "Cannot read from '$infile' $!";
If $read is undefined then while test will already have failed.
my $read;
while ( $read = read IN, $buffer, $blksize ) {
:
}
defined $read or die "Read from '$infile' failed: $!";
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/