You need to put your Perl script into a text file, and not type it immediately into the shell (the "terminal" you see).
To run your very first Perl program immediately, use this in the shell:
perl -we 'print "Hello World!"'
but for longer scripts, create them using a text editor like TextPad or TextMate or in my example vi:
> vi myscript.pl ... enter the script > ls -l myscript.pl -rw-r--r-- 1 corion corion 96 19. Feb 18:09 myscript.pl > perl -w myscript.pl ... output of the script
vi is a versatile text editor, and it likely already is installed on your Mac, but it is not very friendly for a beginner just starting out. Most likely there is a friendly text editor using the OSX GUI included with OSX, but I don't know it. vi has the huge advantage of being available almost everywhere , which is why it helps to have knowledge about it in your toolbox. The two most important things to know about it are the command :q! which quits vi without saving, and :wq, which saves and then quits it.
In reply to Re: Falling at the first hurdle
by Corion
in thread Falling at the first hurdle
by jfxd500
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |