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. 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 Perl in Terminal and it gave me this message:
"Bareword found where operator expected at - line 1, near "$ chmod a"
(Missing operator before a?)"
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.
#!/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 Perl in Terminal and it gave me this message:
"Bareword found where operator expected at - line 1, near "$ chmod a"
(Missing operator before a?)"
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.