D.1. Command Line Arguments

The following table lists the various command line arguments that you can use with Perl. Note that you can also specify arguments on the #! line within individual scripts similar to the following code:

#!/usr/bin/perl -U
ArgumentUse
-aTurns on autosplit mode. Used with the -n or -p options. (Splits to @F.)
-cChecks syntax. (Does not execute program.)
-dStarts the Perl symbolic debugger.
-D numberSets debugging flags.
-e commandEnters a single line of script. Multiple -e arguments can be used to create a multiline script.
-F regexpSpecifies a regular expression to split on if -a is used.
-i[extension]Edits < > files in place.
-I[directory]Used with -P, specifies where to look for include files. The directory is prepended to @INC.
-l [octnum]Enables line-end processing on octnum.
-nAssumes a while (<>) loop around the script. Does not print lines.
-pSimilar to -n, but lines are printed.
-PExecutes the C preprocessor on the script before Perl.
-sEnables switch parsing after program name.
-SEnables PATH environment variable searching for program.
-TForces taint checking.
-uCompiles program and dumps core.
-UEnables Perl to perform unsafe operations.
-vOutputs the version of the Perl executable.
-wEnables checks and warning output for spelling errors and other error-prone constructs in the script.
-x [directory]Extracts a Perl program from input stream. Specifying directory changes to that directory before running the program.
-XDisables all warnings.
−0[octal]Designates an initial ...

Get Web Standards Programmer's Reference: HTML, CSS, JavaScript®, Perl, Python®, and PHP 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.