So as we all suspected it was an end of line issue. What confuses me tho is why the semicolon didn't tell the interpreter that that was the end of the line...every other line is "improperly" ended, but the interpreter doesn't seem to care. I guess not all semicolons are created equal? UPDATE - I just re-read some of the previous posts, and I guess a semicolon in a comment is not created equal as it is rendered irrelevant by being in a comment...makes sense.
What happens when you run the program in the perl debugger?
Don't know how to do that yet
Are you using strict and warnings?
Not yet, but will start. Tried warnings a couple times, but got none, so moved on. Had planned on using the shebang as well, but had to stop until I got this worked out. That's actually what tipped me off to the problem.
If that doesn't work, show us the output, inside <code> tags, of cat -e yourscript, or whatever the equivalent is on MacOS X. That should show any nonprinting...
I ran the cat -e, and it is in fact the ^M that seems to be in there munging it up.
However, the same script when created with vi ran just fine.
yea - I thought of this last night. I started doing my homework in BBedit just because it's a tool I am very used to for other work. I'll get out my little vi pocket ref and dig in...all the vi I ever knew will probably come back to me after a few scripts.
I do plan on trying to make it work the other way too tho. Many thanks to all who came to my rescue!
CTP
| [reply] |
As for the Perl debugger, perl -d <scriptname> should get you started. It's quite useful, I've gotten my non-Perl savvy co-workers into the habit of running it whenever they set up one of our Perl scripts. I just got into the habit of using vi because on one system, that was the only editor I had available, so I learned it (the other telling point was when the fstab on my Linux box got messed up and I had to reboot into standalone mode and edit the thing by hand and at that point, vi is all you've got :-). I played a bit with BBEdit and found that if you do a "Save As" and select "Simple Text" and "ASCII" under the options (or advanced options), the file will get saved the way you want it and run just right (discovered that after I posted the script to clean up the CR/LFs. Anyhow, good luck.
"Ex libris un peut de tout"
| [reply] [d/l] |