![]() |
|
Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Handling A File In Human-Compatible Chunksby broquaint (Abbot) |
on Jun 27, 2005 at 12:10 UTC ( #470231=note: print w/replies, xml ) | Need Help?? |
I don't know of an existing module but you could do it something like this:
So that just sets the INPUT_RECORD_SEPARATOR to paragraph mode, reads paragraphs until we've hit the $size limit, rewinds the file pointer and returns the chunk. However, this does suffer from the bug that it won't read pargraphs greater than $size but I'll leave that as an exercise to the OP of what to do in that case.
HTH
_________
In Section
Seekers of Perl Wisdom
|
|