in reply to Re: Split on field length
in thread Split on field length
Now, it wasn't really specified how to handle this situation, maybe break on whitespace instead? Or just simply overflow? (One application I work with frequently will hang forever trying to break a line longer than 80 characters if there are no spaces in it:-). Anyway, if overflowing is the solution for this particular problem, then Text::Wrap might come to the rescue:
gcuse Text::Wrap qw(wrap); my @parts=do { local $Text::Wrap::columns=45; local $Text::Wrap::huge='overflow'; local $Text::Wrap::separator=",\n"; local $Text::Wrap::break=qr/\s*,\s*/; split /\n/, wrap('','',$string); };
|
|---|