Perl command line switches

=======================================

[Switch item]
[Description]
=========================================

-0
specifies the record separator

-a
used with -n or -p is responsible for turning on auto-split mode for implicit splitting on whitespace characters and putting fields into array @F, eg:
date | Perl -ane 'print "$ F[0] ";

-c
only checks Perl script syntax, does not execute the script

-d
opens the Perl debugger for scripts

-D
Sets the Perl debug flag (please check your Perl installation first to make sure the debugger is installed). To see how Perl executes the script, use -D14

-e command
is used to execute Perl commands on the command line instead of in scripts

-F pattern
specifies the pattern to use when splitting input lines. A pattern is a regular expression between slashes, single quotes, or double quotes. For example, -F/:+/ means to split input lines on one or more colons. turn on -a if it still works

-h
prints a list of Perl command options

-i extension
enables in-place editing mode when looping through files with <>. If no extension is specified, the contents of each line are modified in place. Otherwise, the input filename is modified with the extension (to act as a backup file), and the output file is created with the original filename edited in place. This is also the file handle selected by all print statements

-I directory
is used with the -P option and is responsible for telling the C preprocessor to look for included files, its default directories include /usr/included, /usr/lib/Perl, and the current directory

-1 digits
enables automatic line ending handling. If the -n or -p option is used, the terminator is stripped. Assign the number of digits (octal) to $ and add line terminators to the print statement. If no number of digits is specified, set $ to the current value of $/

-m [-] module
-M [-] module
-M [-] module'
-[mM] module =
arg [,arg]..

-m module
executes the use method before executing the Perl script

-M module
executes the use method before executing the Perl script. If adding additional text, use quotation marks. The dash in square brackets means to replace the use directive with no

-n
causes Perl to implicitly loop through the specified file and print only the specified lines

-p
causes Perl to implicitly loop through the specified file while printing all lines

-P
causes the script to be run to go through the C preprocessor before Perl compilation

-s
enables switch parsing after the script name and before the filename argument, and removes all found switches from the @ARGV array. Set the switch item to a scalar variable of the same name, and assign the scalar value 1. For example, -abc in the script will be converted to $abc

-S Causes
Perl to search the PATH environment variable for scripts if the line #!/usr/bin/perl is not supported

-T
forces the "pollution" check to be turned on, for test scripts, generally only used on setuid or setgid programs. It is recommended to check CGI scripts by yourself

-u
Generate a core dump of the script after compilation (UNIX-based systems)

-U
allows Perl to perform unsafe operations and break directory links if superuser

-v
print Perl version information

-V
prints the most important Perl configuration items and a summary of the current values ​​in the array @INC

-V:NAME
prints the value of NAME, where NAME is a configuration variable

-w
print warnings, including misuse of reserved words, file handles, subroutines, etc.

-W
enables all warnings, regardless of whether local warnings have been turned off with no warnings

-x directory Ignore any text before the #!/usr/bin/perl line. If you pass a directory name as an argument to the -x switch, Perl will automatically switch to that directory before starting script execution

-X
turns off all warnings

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327080453&siteId=291194637