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
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. |
-D number | Sets debugging flags. |
-e command | Enters a single line of script. Multiple -e arguments can be used to create a multiline script. |
-F regexp | 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 ... |
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.