Most likely you are trying to run the script on a Unixish machine but the file uses Windows-style \r\n line endings.
If that is the case, the kernel will look at the file, see that it starts with #! and it will then read the line and try to execute the first word on that line as the interpreter. Likely, parsing for words only means "space or newline", so the kernel will see:
/usr/bin/perl\r
as the program to execute. There is no such program. Once you add -w to the command line, the kernel will see:
/usr/bin/perl -w\r
and use /usr/bin/perl as the program and -w\r as the first parameter to it. This starts Perl.
In any case, it is good to run with the -w switch always as this allows Perl to tell you about problematic things in your code. |