Webmaster in a Nutshell

Previous Chapter 15 Next

15. Perl Quick Reference

Subroutines, Packages, and Modules
Object-Oriented Programming
Arithmetic Functions
Conversion Functions
Structure Conversion
String Functions
Array and List Functions
Regular Expressions
Search and Replace Functions
File Test Operators
File Operations
Directory Reading Routines
System Interaction
System V IPC
Information from System Files
Special Variables
Special Arrays
Environment Variables
The Perl Debugger

Perl is the most common programming language used for CGI throughout the Web. This chapter gives a quick reference to Perl syntax and functions. To learn Perl from scratch, we recommend Learning Perl by Randal Schwartz. For Perl reference, we recommend Programming Perl, Second Edition by Larry Wall, Tom Christiansen, and Randal Schwartz. Both are published by O'Reilly & Associates.

Items followed by a dagger ((dagger)) will default to $_ if omitted.

15.1 Command-Line Options


Turns on autosplit mode when used with -n or -p. Splits to @F.


Checks syntax but does not execute.


Runs the script under the debugger. Use -de 0 to start the debugger without a script.

-D number

Sets debugging flags.

-e commandline

May be used to enter a single line of script. Multiple -e commands may be given to build up a multiline script.

-F regexp

Specifies a regular expression to split on if -a is in effect.


Files processed by the < > construct are to be edited in place.


With -P, tells the C preprocessor where to look for include files. The directory is prepended to @INC.

-l [ octnum ]

Enables automatic line-end processing, e.g., -l013.


Assumes an input loop around your script. Lines are not printed.


Assumes an input loop around your script. Lines are printed.


Runs the C preprocessor on the script before compilation by Perl.


Interprets -xxx on the command line as a switch and sets the corresponding variable $xxx in the script.


Uses the PATH environment variable to search for the script.


Forces taint checking.


Dumps core after compiling the script. To be used with the undump(1) program (where available).


Allows Perl to perform unsafe operations.


Prints the version and patchlevel of your Perl executable.


Prints warnings about possible spelling errors and other error-prone constructs in the script.

-x [ dir ]

Extracts Perl program from input stream. If dir is specified, switches to this directory before running the program.


(That's the number zero.) Designates an initial value for the record separator $/. See also -l.

Previous Home Next
Results Processing Book Index Literals

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell
Hosted by uCoz