perl
is the interpreter for the Perl programming language (the Swiss Army knife of Unix programming tools). The Perl program is provided via one or more -e
options. If no -e
options are used, the first file named on the command line is used for the program.
For more information about Perl, see Learning Perl
, Programming Perl
, and Advanced Perl Programming
, all listed in the Bibliography.
Note: while not distributed with SVR4 or Solaris, perl
is widely used for the Web, CGI, and system-administration tasks, and many other things. The starting point for All Things Perl is http://www.perl.com
.
This option list is for perl
Version 5.005 patchlevel 2. See perlrun
(1) for more details.
-a
Turn on autosplit mode when used with -n
or -p
. Splits to @F
.
-c
Check syntax but does not execute.
-d
Run the script under the debugger. Use -de 0
to start the debugger without a script.
-d
:
module
Run the script under control of the module installed as Devel:
module
.
-D
flags
Set debugging flags. flags
may be a string of letters, or the sum of their numerical equivalents. See "Debugging Flags." perl
must be compiled with -DDEBUGGING
for these flags to take effect.
-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
Specify a regular expression to split on if -a
is in effect.
-h
Print a summary of the options.
-i
[ext
]
Files processed by the <>
construct are to be edited in place. The old copy is renamed, and the processed copy is written to the original filename. The optional ext
indicates an extension to use for the renamed copy. Various rules apply to how this is done; see perlrun
(1).
-I
dir
With -P
, tells the C preprocessor where to look for include files. The directory is also prepended to @INC
.
-l
[octnum
]
Enables automatic line-end processing, e.g., -l013
.
-m
[-
]module
Equivalent to use
module
();
. With a -
after -m
, it is equivalent to no
module
();
.
-m
[-
]'
module
=
arg
[,arg
]'
, -M
[-
]'
module
=
arg
[,arg
]'
,
Shorthand for -M'module qw(arg ...)'
. This avoids the need for quoting inside the argument.
-M
[-
]'
module
[...]'
Equivalent to use
module
...;
. With a -
after -M
, it is equivalent to no
module
...;
. The "..." represents additional code you might wish to supply, for example:
-M'mymodule qw(whizfunc wimpfunc)'
-n
Assume an input loop around your script. Input lines are not printed. (Like sed -n
or awk
.)
-p
Assume an input loop around your script. Input lines are printed. (Like sed
.)
-P
Run the C preprocessor on the script before compilation by perl
.
-s
Interpret -
xxx
on the command line as a switch and sets the corresponding variable $xxx
in the script.
-S
Use the PATH
environment variable to search for the script.
-T
Force taint checking.
-u
Dump core after compiling the script. For use with the undump
(1) program (where available). Largely superseded by the Perl-to-C compiler that comes with perl
.
-U
Allow perl
to perform unsafe operations.
-v
Print the version and patchlevel of the perl
executable.
-V
Print the configuration information and the value of @INC
.
-V
:
var
Print the value of configuration variable var
to standard output.
-w
Print warnings about possible spelling errors and other error-prone constructs in the script.
-x
[dir
]
Extract the Perl program from the input stream. If dir
is specified, perl
switches to it before running the program.
-0
val
(That's the number zero.) Designate an initial value for the record separator $/
. See also -l
.