Here's what I use:
use Text::Format;
my $text = 'some text string of words, possibly having more than 990 c
+haracters ...';
my $text_obj = Text::Format->new( {
columns => 990,
firstIndent => 0,
bodyIndent => 0,
} );
$text = $text_obj->format($text);
I've read that Sendmail's default is 990 rather than 1000; I think I ran into the 990 limitation when sending email through my local Postfix installation (which replaces Sendmail), and hence picked 990 as the "columns" parameter to send to Text::Format.
Text::Format splits the string into words, meaning it splits on white space (\s+). A seven-letter word that starts at column 986 after a blank at column 985 wouldn't be printed as 5 characters ending at column 990 with the remaining two characters starting on column 1 of the next line; it would move the word to be the start of the next line. The previous line would end with the word whose last character is in column 984 (assuming for purposes of this example that a single blank space existed between that word and the word that's moved down to start the next line).