in reply to Re: (OT) Fixing Line Endings
in thread (OT) Fixing Line Endings
A Perl program that is created on Windows will have Windows line end characters (i.e. CR/LR or \015\012). If you upload that to a Unix server without translating the line endings then your shebang line will look like this:
#!/usr/bin/perl\r\n
The \n is the line end character for Unix, so that's not a problem. But some Unix shells will look for a program called /usr/bin/perl\r and, usually, won't find it.
As a couple of us have suggested, adding an option to the shebang line solves the problem as the shebang line will then look like this:
#!/usr/bin/perl -w\r\n
The shell parses the command name (/usr/bin/perl) out of that and passes the rest of it (-w\r) to the Perl interpreter as options. Perl is cleverer than the shell and will handle both kinds of line endings.
<http://dave.org.uk>
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg