It is a good idea to use all uppercase letters for your
file variable names. This makes it easier to distinguish
file variable names from other variable names and from
reserved words.
Programming Examples
Each feature of Perl is illustrated by examples of its use. In addition, each chapter of
this book contains many useful programming examples complete with explanations; these
examples show you how you can use Perl features in your own programs.
Each example contains a listing of the program, the input required by and the output
generated by the program, and an analysis of how the program works. Special icons are
used to point out each part of the example: Type, Input-Output, and Analysis.
In the Input-Output example following Listing IN.1, there are some special typographic
conventions. The input you enter is shown in bold monospace type, and the output
generated by the system or the program is shown in plain monospace type. The system
prompt ($ in the examples in this book) is shown so that you know when a command is to
be entered on the command line.
Listing IN.1. A simple Perl program with comments.
1: #!/usr/local/bin/perl
2: # this program reads a line of input, and writes the line
3: # back out
4: $inputline = <STDIN>; # read a line of input
5: print( $inputline ); # write the line out
$ programIN_1
This is a line of input.
This is a line of input.
$