I suggest you split the message on "\n\n", wrap each fragment separately and then re-join them.<div>-Dave<br><div><br><div class="gmail_quote">On Thu, Oct 4, 2012 at 9:09 AM, George Hartzell <span dir="ltr"><<a href="mailto:hartzell@alerce.com" target="_blank">hartzell@alerce.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">Richard Reina writes:<br>
> I have a text files that need to be word wrapped neatly so they can be<br>
> turned into emails. They consist of:<br>
><br>
> Dear (or Hello) Jim,<br>
><br>
> Nice meeting with you on Thursday. Blah<br>
> blah, blah.<br>
> blah, blah, blah,<br>
><br>
> Thanks,<br>
><br>
> Richard<br>
><br>
> Text::Wrap does a great job in breaking up and wrapping the lines my<br>
> problem is that since it removes all the "\n" s<br>
> I end up with:<br>
><br>
> Dear Jim, Nice meeting with you on Thursday. Blah<br>
> blah, blah.<br>
> blah, blah, blah, Thanks, Richard<br>
><br>
> To counter this I began writing various conditionals that try to guess the<br>
> first and last lines of the file so that they can be preserved separately<br>
> and added after Text::Wrap has done it's work. However, it's very<br>
> convoluted and I am not so confident it will work. So I am wondering if<br>
> anyone know of a better way to accomplish the task?<br>
<br>
</div></div>At the simple end of the spectrum, how about just running the message<br>
text through fmt (/usr/bin/fmt on mac os and freebsd).<br>
<br>
At the other end of the spectrum, how about using Markdown in the<br>
source text file and then running it through a converter. That'll<br>
open the entire world of Email-MIME-Kit<br>
(<a href="http://search.cpan.org/dist/Email-MIME-Kit/" target="_blank">http://search.cpan.org/dist/Email-MIME-Kit/</a>).<br>
<br>
g.<br>
_______________________________________________<br>
SanFrancisco-pm mailing list<br>
<a href="mailto:SanFrancisco-pm@pm.org">SanFrancisco-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/sanfrancisco-pm" target="_blank">http://mail.pm.org/mailman/listinfo/sanfrancisco-pm</a><br>
<br>
</blockquote></div><br></div></div>