Appendix B. Perl Summary
This appendix summarizes those parts of the Perl programming language that will be most useful to you as you read this book. It is not a comprehensive summary of the Perl language. Remember that Perl is designed so that you don’t need to know everything in order to use it. Source material for this appendix came from Programming Perl, Third Edition (O’Reilly & Associates).
The Perl programs in this book start with the line (with or without the -w):
On Unix (or Linux) systems, the first line of a file can include the name of a
program and some flags, which are optional. The line must start with
#!, followed by the full pathname of the program (in
our case, the Perl interpreter), followed optionally by a single group of one or
If the Perl program file is called myprogram,
and has executable permissions, you can type
myprogram (or possibly
./myprogram, or the full or relative pathname for the program) to start
the program running.
The Unix operating system starts the program specified in the command interpretation line and gives it as input the rest of the file after the first line. So, in this case, it starts the Perl interpreter and gives it the program in the file to run.
This is just a shortcut for typing:
/usr/bin/perl -w myprogram
at the command line.
A comment begins with a # sign and continues from there to the end of the same line. It is ignored by the Perl interpreter and is only there for programmers ...