I am just beginning to learn Perl so I can handle the forms on my website. The very first thing is to do the "Hello,World" code. I typed and saved the code as a ".pl" file. But when I try to get it to run, I get this long string of mistakes. I am using an iMac OS 10.6.8, which is running perl, v5.10.0 built for darwin-thread-multi-2level. Here's my code:


#!/usr/bin/perl
use strict;
use warning;

print "Hello, World!\n";


Here's my error list:


Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 1, near "rtf1\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 1, near "ansi\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 1, near "ansicpg1252\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 1, near "cocoartf1038\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 2, near "fonttbl\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 2, near "f0\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 2, near "fswiss\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 3, near "red255\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 3, near "green255\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 4, near "margl1440\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 4, near "margr1440\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 4, near "vieww9000\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 4, near "viewh8400\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 5, near "viewkind0 \" (Missing semicolon on previous line?) Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 5, near "pard\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 5, near "tx720\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 5, near "tx1440\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 5, near "tx2160\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 5, near "tx2880\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 5, near "tx3600\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 5, near "tx4320\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 5, near "tx5040\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 5, near "tx5760\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 5, near "tx6480\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 5, near "tx7200\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 5, near "tx7920\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 5, near "tx8640\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 5, near "ql\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 5, near "qnatural\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 7, near "pardirnatural \" (Missing semicolon on previous line?) Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 7, near "f0\" Backslash found where operator expected at /Users/patnonadmin/Desktop/hello#1.pl line 7, near "fs24 \" (Do you need to predeclare fs24?) syntax error at /Users/patnonadmin/Desktop/hello#1.pl line 1, near "rtf1\" syntax error at /Users/patnonadmin/Desktop/hello#1.pl line 3, near "red255\" syntax error at /Users/patnonadmin/Desktop/hello#1.pl line 4, near "margl1440\" "use" not allowed in expression at /Users/patnonadmin/Desktop/hello#1.pl line 8, at end of line "use" not allowed in expression at /Users/patnonadmin/Desktop/hello#1.pl line 9, at end of line syntax error at /Users/patnonadmin/Desktop/hello#1.pl line 11, near ";}" Execution of /Users/patnonadmin/Desktop/hello#1.pl aborted due to compilation errors.


Why is there such a long list? I'm assuming that the Terminal is running "macperl" but it doesn't say so.


How do I get past this mess?


Thanks.


In reply to Beginning Problems by wwplyr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



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