In How to make a CPAN module Ditribution I noted that there are issues with ^M ie the CR part or CRLF that you get for a line ending on Win32 when you move such a script to Linux. A monk just noted that he was less than convinced. I was thinking scripts (rather than Modules but you always have test scripts in a distro). Here is the evidence relating to the problem I get:

[root@devel3 root]# cat bad.pl #!/usr/bin/perl print "Hello Errors!\n" [root@devel3 root]# perl -pe 's/\015/^M/' bad.pl #!/usr/bin/perl^M print "Hello Errors!\n"^M [root@devel3 root]# ./bad.pl : bad interpreter: No such file or directory [root@devel3 root]# perl -pi -e 's/\015//' bad.pl [root@devel3 root]# ./bad.pl Hello Errors! [root@devel3 root]# perl -pe 's/\015/^M/' bad.pl #!/usr/bin/perl print "Hello Errors!" [root@devel3 root]#

So you can see that the \015 is present and causes the breakage shown which goes away when you make the \015s go away. Q: Why is it so?

cheers

tachyon


In reply to Why does Perl choke on \015 ^M chars by tachyon

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.