index
Practical Extraction and Report Language
A Perl script consists of a sequence of declarations and statements.
The only things that need to be declared in Perl are report formats
and subroutines. See the sections below for more information on those
declarations. All uninitialized user-created objects are assumed to
start with a null or 0 value until they are defined by some explicit
operation such as assignment. (Though you can get warnings about the
use of undefined values if you like.) The sequence of statements is
executed just once, unlike in sed and awk scripts, where the
sequence of statements is executed for each input line. While this means
that you must explicitly loop over the lines of your input file (or
files), it also means you have much more control over which files and
which lines you look at. (Actually, I'm lying--it is possible to do an
implicit loop with either the -n
or -p switch. It's just not the
mandatory default like it is in sed and awk.)