in reply to Re^2: Thrashing on very large lines
in thread Thrashing on very large lines

Moving the check for $read == 0 was quite appropriate. Admittedly, $skip was not optimally named. (I'd prefer $in_bad_record. It was called $skip because I initially discarded the bad stuff. I didn't notice you wanted to keep it.) However, your fix of the bug in read wasn't optimal.

Me:

my $read = read($fh_in, $buf, $blk_size, length($ofs));

You:

my $read = read($fh_in, $newbuf, $blk_size); ... $buf .= $newbuf;
What it should be:
my $read = read($fh_in, $buf, $blk_size, length($buf));

Replies are listed 'Best First'.
Re^4: Thrashing on very large lines
by chr1so (Acolyte) on Apr 21, 2006 at 00:47 UTC
    What it should be:
    my $read = read($fh_in, $buf, $blk_size, length($buf));
    I understand now. When I read the description for read(), I mistakingly thought it was for an offset in the file.

    Thanks again. This was a great help and learning experience.