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
Argument
Use
-a
Turns on autosplit mode. Used with the -n or -p options. (Splits to @F.)
-c
Checks syntax. (Does not execute program.)
-d
Starts the Perl symbolic debugger.
-Dnumber
Sets debugging flags.
-ecommand
Enters a single line of script. Multiple -e arguments can be used to create a multiline script.
-Fregexp
Specifies 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.
-n
Assumes a while (<>) loop around the script. Does not print lines.
-p
Similar to -n, but lines are printed.
-P
Executes the C preprocessor on the script before Perl.
-s
Enables switch parsing after program name.
-S
Enables PATH environment variable searching for program.
-T
Forces taint checking.
-u
Compiles program and dumps core.
-U
Enables Perl to perform unsafe operations.
-v
Outputs the version of the Perl executable.
-w
Enables 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.
-X
Disables all warnings.
−0[octal]
Designates an initial value for the record separator, $/. See also -l.