Hi, I've just started using perl and was attempting to use a simple program.
#!/usr/bin/perl print "Hello World\n";
However when I went to run in through terminal I get this response. In terminal I am in the folder where the program is located and type in perl hello.pl I get the following error
Backslash found where operator expected at hello.pl line 1, near "rtf1 +\" Backslash found where operator expected at hello.pl line 1, near "ansi +\" Backslash found where operator expected at hello.pl line 1, near "ansi +cpg1252\" Backslash found where operator expected at hello.pl line 1, near "coco +artf1038\" Backslash found where operator expected at hello.pl line 2, near "font +tbl\" Backslash found where operator expected at hello.pl line 2, near "f0\" Backslash found where operator expected at hello.pl line 2, near "fmod +ern\" Backslash found where operator expected at hello.pl line 3, near "red2 +55\" Backslash found where operator expected at hello.pl line 3, near "gree +n255\" Backslash found where operator expected at hello.pl line 4, near "marg +l1440\" Backslash found where operator expected at hello.pl line 4, near "marg +r1440\" Backslash found where operator expected at hello.pl line 4, near "view +w9000\" Backslash found where operator expected at hello.pl line 4, near "view +h8400\" Backslash found where operator expected at hello.pl line 5, near "view +kind0 \" (Missing semicolon on previous line?) Backslash found where operator expected at hello.pl line 6, near "deft +ab720 \" (Missing semicolon on previous line?) Backslash found where operator expected at hello.pl line 6, near "pard +\" Backslash found where operator expected at hello.pl line 6, near "pard +eftab720\" Backslash found where operator expected at hello.pl line 6, near "ql\" Backslash found where operator expected at hello.pl line 8, near "qnat +ural \" (Missing semicolon on previous line?) Backslash found where operator expected at hello.pl line 8, near "f0\" Backslash found where operator expected at hello.pl line 8, near "fs24 + \" (Do you need to predeclare fs24?) Backslash found where operator expected at hello.pl line 9, near "cf0 +#!/usr/bin/perl -w\ \" (Missing semicolon on previous line?) syntax error at hello.pl line 1, near "rtf1\" syntax error at hello.pl line 3, near "red255\" syntax error at hello.pl line 4, near "margl1440\" "use" not allowed in expression at hello.pl line 10, at end of line "use" not allowed in expression at hello.pl line 11, at end of line syntax error at hello.pl line 14, near "}" Execution of hello.pl aborted due to compilation errors.
Does anyone have any idea what I am doing wrong or what is going on with my machine? Thank You

In reply to Unsure why this isn't working? by Anonymous Monk

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.