That's a common problem with DOS versus unix file format.  U can use the
commandline tool dos2unix to convert it after u upload it.  DOS creates new
lines explicitly with the sequence CRLF while unix just uses LF (making the
CR implicit).

A simple workaround so that the file remains valid on both Windows and unix
is to add -I/dev/null to the shebang line at the beginning of the script.
This is a fix because it's the trailing CR at the end of that line that's
messing up ur script.  The system is looking for an interpretor literally
named "/usr/bin/perl^M".  It's blindly splitting the line on LF characters.
The -I/dev/null will "eat" the CR at the line's end allowing the system to
locate /usr/bin/perl.

So like this:
#!/usr/bin/perl -I/dev/null

This doesn't hurt anything since /dev/null can never affect ur program on
unix and it simple doesn't exist on Windows.  U can tell if they're there or
not by viewing the file with vi/vim on the unix box.  It will print them as
^M if present.


At 01:40 PM 6/25/2007 -0700, Chris Rodriguez wrote:
>Hi everyone,
>  I wrote a cgi script in PERL which won't execute.  I'm told it's  because
I have control M's at the end of each line, and that this  happens when
editing programs in Windows (which I do, with  Notepad).  I found a free
program on 




--
REMEMBER THE WORLD TRADE CENTER         ---=< WTC 911 >=--
"...ne cede malis"

00000100

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to