<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
When the line endings are \r\n instead of just \n, vim sets the
fileformat to dos instead of unix. This is why list mode didn't
reveal them. To fix them using vim:<br>
<br>
vim test.pl<br>
:se ff=unix (short form of ":set fileformat=unix")<br>
:wq<br>
<br>
- Brian<br>
<br>
On 2011-06-17 10:19, tiger peng wrote:
<blockquote cite="mid:252127.27347.qm@web120512.mail.ne1.yahoo.com"
type="cite">
<div style="color: rgb(0, 0, 0); background-color: rgb(255, 255,
255); font-family: arial,helvetica,sans-serif; font-size: 10pt;">
<div>Thanks, You are right. (I thought after using vi to edit
it, the \r should be gone)<br>
</div>
<div><br>
<span></span></div>
<div><span style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">/tmp></span><span><span
style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">$ od -c test.pl</span><br
style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">
<span style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">0000000 #
! / u s r / l o c a l / b i n</span><br
style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">
<span style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">0000020 /
p e r l <font size="3"><span
style="background-color: rgb(255, 0, 0);">\r </span> </font>\n
s y s t e m ( '</span><br
style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">
<span style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">0000040 w
h i c h p e r l ' ) ; \r \n p</span><br
style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">
<span style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">0000060 r
i n t " h i \ n " ; \r \n</span><br
style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">
<span style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">0000076</span><br
style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">
<span style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">/tmp>$ perl
-i -pe 's/\r//' test.pl</span><br style="font-family:
Courier New,courier,monaco,monospace,sans-serif;">
<span style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">$ od -c test.pl</span><br
style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">
<span style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">0000000 #
! / u s r / l o c a l / b i n</span><br
style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">
<span style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">0000020 /
p e r l \n s y s t e m ( ' w</span><br
style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">
<span style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">0000040 h
i c h p e r l ' ) ; \n p r i</span><br
style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">
<span style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">0000060 n
t " h i \ n " ; \n</span><br
style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">
<span style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">0000073</span><br
style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">
<span style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">/tmp>$
test.pl</span><br style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">
<span style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">/usr/local/bin/perl</span><br
style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">
<span style="font-family: Courier
New,courier,monaco,monospace,sans-serif;">hi</span><br>
</span></div>
<div><span><br>
</span></div>
<div><br>
</div>
<div style="font-family: arial,helvetica,sans-serif; font-size:
10pt;">
<div style="font-family: times new roman,new york,times,serif;
font-size: 12pt;"><font face="Arial" size="2">
<hr size="1"><b><span style="font-weight: bold;">From:</span></b>
Clyde Forrester <a class="moz-txt-link-rfc2396E" href="mailto:clydeforrester@gmail.com"><clydeforrester@gmail.com></a><br>
<b><span style="font-weight: bold;">To:</span></b>
Chicago.pm chatter <a class="moz-txt-link-rfc2396E" href="mailto:chicago-talk@pm.org"><chicago-talk@pm.org></a><br>
<b><span style="font-weight: bold;">Sent:</span></b>
Friday, June 17, 2011 9:42 AM<br>
<b><span style="font-weight: bold;">Subject:</span></b>
Re: [Chicago-talk] Perl script cannot find itself?<br>
</font><br>
I generally use the od -c command to check for stuff like
that.<br>
If you see "0d 0a" combinations instead of just "0a", then
you have carriage returns.<br>
<br>
od -c <a moz-do-not-send="true" target="_blank"
href="http://test.pl">test.pl</a><br>
<br>
c4<br>
<br>
tiger peng wrote:<br>
> I checked them with vi's list command, there is no
cartridge return character in the scripts.<br>
> <br>
>
------------------------------------------------------------------------<br>
> *From:* Andrew Rodland <<a moz-do-not-send="true"
ymailto="mailto:andrew@cleverdomain.org"
href="mailto:andrew@cleverdomain.org">andrew@cleverdomain.org</a>><br>
> *To:* <a moz-do-not-send="true" target="_blank"
href="http://Chicago.pm">Chicago.pm</a> chatter <<a
moz-do-not-send="true"
ymailto="mailto:chicago-talk@pm.org"
href="mailto:chicago-talk@pm.org">chicago-talk@pm.org</a>><br>
> *Sent:* Thursday, June 16, 2011 9:19 PM<br>
> *Subject:* Re: [Chicago-talk] Perl script cannot find
itself?<br>
> <br>
> On Thursday, June 16, 2011 04:47:39 PM tiger peng
wrote:<br>
> > There are two Perl scripts only different by the
first line. Why the one<br>
> > without -w in the #! line cannot find itself but
the own with -w can?<br>
> <br>
> Because you saved the file with windows line-endings,
and there's a \cM at the<br>
> end of every line. In the first case, the kernel is
looking for<br>
> "/usr/local/bin/perl\cM" and can't find it. In the
second case the kernel is<br>
> looking for "/usr/local/bin/perl" and running it with
an argument of "-w\cM",<br>
> which is harmless.<br>
_______________________________________________<br>
Chicago-talk mailing list<br>
<a moz-do-not-send="true"
ymailto="mailto:Chicago-talk@pm.org"
href="mailto:Chicago-talk@pm.org">Chicago-talk@pm.org</a><br>
<a class="moz-txt-link-freetext" href="http://mail.pm.org/mailman/listinfo/chicago-talk">http://mail.pm.org/mailman/listinfo/chicago-talk</a><br>
<br>
<br>
</div>
</div>
</div>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Chicago-talk mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Chicago-talk@pm.org">Chicago-talk@pm.org</a>
<a class="moz-txt-link-freetext" href="http://mail.pm.org/mailman/listinfo/chicago-talk">http://mail.pm.org/mailman/listinfo/chicago-talk</a></pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Brian Katzung, Kappa Computer Solutions, LLC
Leveraging UNIX, GNU/Linux, open source, and custom
software solutions for business and beyond
Phone: 877.367.8837 x1 <a class="moz-txt-link-freetext" href="http://www.kappacs.com">http://www.kappacs.com</a>
</pre>
</body>
</html>