Appendix A. 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 (O’Reilly).

Command Interpretation

The Perl programs in this book start with a line something like:

#!/usr/bin/perl

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 this case, the Perl interpreter), followed optionally by a single group of one or more flags. It’s common in Perl programs to see the -w flag on this first command interpreter line, like so:

 #!/usr/bin/perl -w

The -w flag turns on extra warnings. I prefer to do that with the line:

use warnings;

because it’s more portable to different operating systems.

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 ...

Get Mastering Perl for Bioinformatics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.