If anyone is curious, here are some test results based on your advice:
I downloaded and tried out
optiperl and, making sure to switch the files to "Unix Format", got exactly the same results as with textpad.
I ran
od -c on it, and it showed lots of \r\n pairs.
I then ran dos2unix on the file, and that fixed the file so it worked.
I then downloaded the file, changed its name, and uploaded it again. It still worked, so I don't think the problem is with the FTP client (which, incidentally, I run in "always ASCII" mode).
I also tried the -- switch, which made the script run too.
Incidentally, I have very good reasons for avoiding the -w switch, which you can read about
here if you are curious.
Thank you all for your advice. I have a working solution now, but no real understanding why my perl scripts are always created with \r\n pairs. I will try a couple more editors.
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.