I'm *really* new to Perl, so my question is probably going to sound real stupid. Anyhow, I am reading "Learning Perl" by Randal Schwartz (AKA "The Llama Book") and I am trying to run my first simple program using Terminal on OS X. Here's the program:
#!/usr/bin/perl print "Hello, world!\n";
I put these lines in a text editor (in BBEdit, actually). The book said to then enter the following command (I'm not sure if Schwartz meant within Perl):
$ chmod a+x my_program
Then, enter this command:
$ ./my_program
Now I had tried running this in Terminal and it gave me this message:
"Bareword found where operator expected at - line 1, near "$ chmod a"<br< (Missing operator before a?)"
I then dropped the $ and tried typing the command "chmod a+x my_program" and it gave me no respone. In fact, it seems like it ignored it without by returning me to the command prompt.
Am I doing something wrong? I also have the document on my Desktop. Am I not supposed to have it there? Also, Schwartz mentioned something about not having an extension on the text file. I don't see any, but should I change it to .plx anyway?
Any advice? Thanks in advance from an aspiring Perl programmer.

In reply to Using Perl on OS X by 1st_try

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.