Greetings, Perl control-character gurus. This lowly perl peon seeks advice on what is probably a very simple control char problem... My script takes input from a text box and prints it into an email (sent using unix sendmail). When I send these emails to myself, my email program (Pegasus mail) shows ~nl~ wherever the user hit return in the original text box, yet other parts of the script which generate *html* from the text input work fine. I presume the ~nl~ means newline, so I have tried adding s/// lines to remove \n, \r, cM, etc. Nothing I have hit upon seems to fix this.
---------------------------- Original code: sub add_email_message { $subject = "New Ad"; $message = "The following ad (number $new_counter) was added. $form_data{'caption_header'} $form_data{'caption'} $form_data{'text'} ...(notice assignment to $message has not reached end quote)... ------------------------------------------ New code: sub add_email_message { $peg_nl = $form_data{'text'}; $peg_nl =~ s/\n/ /g; $subject = "New Ad"; $message = "The following ad (number $new_counter) was added. $form_data{'caption_header'} $form_data{'caption'} $peg_nl ...(notice assignment to $message has not reached end quote)... ----------------------------------
I will reward you with 1000 thank-you's if you can help with this, because then I can go eat dinner! :)

In reply to Control chars when printing into emails by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.