Er, I can never remember the darned line endings, but I'd try something like:

{ local $/ = "\n"; chomp $email; }

$/ is the input record separator. That's what chomp really removes. By using local in the brackets, you can temporarily reset that to whatever you need to chomp on. After you leave the brackets, $/ will have its previous value restored.

(I think it's "\n" for Unix, but I can't recall.)

Oh, wait. It's a Windows file uploaded to Unix that's the problem? Then I think the line ending might be "\r\n". I never keep those straight.

And for the record, the problem is because Unix and Windows use different line endings and chomp defaults to the line ending of the OS you currently are on.

Cheers,
Ovid

New address of my CGI Course.


In reply to Re: Chomp doesn't seem to work by Ovid
in thread Chomp doesn't seem to work by JaredHess

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.