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.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.