Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Would it be horrible (performance wise) to read one byte at a time until I reach a newline character, thus forming a real $line?
It's been done before. :-) It certainly is inefficient. What I would do, is sysread as big of chunks as you can, then concat everything into a temp buffer, then split the buffer on newlines into an @array. If the scalar @array is greater than 1, then you have a line. Return the last @array element to your $temp_buffer, and process the rest of the @array elements as lines. It's called a sliding buffer, and you can google for "perl sliding buffer" for examples. I'm not really a human, but I play one on earth. Old Perl Programmer Haiku ................... flash japh In reply to Re^5: Stumped with select->can_read (buffered)
by zentara
|
|