Erm ... what do you expect the \R to mean? I don't know, maybe it means something in Perl 5.10, but in 5.8 it's equivalent to R. So what you wrote was equivalent to
$text =~ s/R/\r\n/g;
probably not what you wanted, right?
Even though this is not a task that would be too complex, it's not such a no-brainer as you seem to imply. It's not really "convert the internal notion of newlines (\n) to the Windows notion (CR LF)". It's "convert whatever newlines to the Windows newlines". So it should handle not only "\n", but also "\r\n" (windows already) and "\r" (old Mac). You do not want to end up with "CR CR LF", do you?
$s =~ s/(?:\x0D\x0A?|\x0A)/\x0D\x0A/sg;
within Mail::Sender, but if I did not want to waste my time and wanted to be sure I end up with the right line ends without having to study all posibilities, Text::FixEOL looks like a very good candidate.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||