You came _this_ close to getting it right :)
while ($requests = <REQUESTS>) { if ($requests ne "\n") { print MAIL "$requests"; } }
The problem is that single quotes don't convert things like \n, so you were printing everything except lines that contain a literal \, followed by a literal n.

In the "there's more than one way to do it" tradition, you could just use the grep command.

print MAIL grep !/^$/,<REQUESTS>;
The "empty line" regular expression will work because $ will match just before the \n.

You could also write your code using the "suffix" form of the condition.

while ($requests = <REQUESTS>) { print MAIL $requests if $requests ne "\n"; }
or
while ($requests = <REQUESTS>) { print MAIL $requests unless $requests=~/^$/; }
Hope this helps!
--
Mike (Edit: had fouled up the grep example)

In reply to Re: removing carriage returns by RMGir
in thread removing carriage returns by chrisbarton

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.