Linux and Unix perl command
Quick links
About perl
Syntax
Examples
Where to obtain Perl
Related commands
Linux and Unix main page
Perl is a programming language optimized for scanning arbitrary text files, extracting information from those text files, and printing reports based on that information. It's also a good language for many system management tasks. The language is intended to be practical (easy to use, efficient, complete) rather than beautiful (tiny, elegant, minimal).
perl [-s] [-T] [-u] [-U] [-h] [-v] [-V[:configvar] ] [-c] [-w] [-d[:debugger] ] [ -D[number/list] ] [-p] [-n] [-a] [ -F pattern ] [ -l[octal] ] [-0[octal] ] [ -Idir ] [ -m[-]module ] [ -M[-]'module...' ] -P] [-S] [-x[dir] ] [ -i[extension] ] -e 'command'] [ -- ] [programfile] [argument]
| -s | Enables rudimentary option parsing for options on the command line after the script name but before any file name arguments (or before a
|
||||||||||||||||||||||||||||||||||||||||||||||||
| -T | Forces "taint" checks to be turned on so you can test them. | ||||||||||||||||||||||||||||||||||||||||||||||||
| -u | |||||||||||||||||||||||||||||||||||||||||||||||||
| -U | Allows perl to do unsafe operations. | ||||||||||||||||||||||||||||||||||||||||||||||||
| -h | |||||||||||||||||||||||||||||||||||||||||||||||||
| -v | Prints the version and patch level configuration of your perl executable. | ||||||||||||||||||||||||||||||||||||||||||||||||
| -V[:conigvar] | Prints summary of the major perl configuration values and the current value of @INC. | ||||||||||||||||||||||||||||||||||||||||||||||||
| -c | Checks the syntax of the script and then exits without executing it. | ||||||||||||||||||||||||||||||||||||||||||||||||
| -w | Prints warnings about variable names that are mentioned only once, and scalar variables that are used before being set. | ||||||||||||||||||||||||||||||||||||||||||||||||
| -d | Runs the script under the perl debugger | ||||||||||||||||||||||||||||||||||||||||||||||||
| -D |
Sets debugging flags. To turn on debugging flags, you can either specify a number which is the total of the numeric
values of the desired flags (for example,
|
||||||||||||||||||||||||||||||||||||||||||||||||
| -p | assumes the following loop around your script.
while (<>) { |
||||||||||||||||||||||||||||||||||||||||||||||||
| -n | Assumes the following loop around your script.
while (<>) { |
||||||||||||||||||||||||||||||||||||||||||||||||
| -a | Turns on autosplit mode when used with a |
||||||||||||||||||||||||||||||||||||||||||||||||
| -F pattern | Specifies a pattern expression to split on | ||||||||||||||||||||||||||||||||||||||||||||||||
| -l octal | Enables automatic line-ending processing. | ||||||||||||||||||||||||||||||||||||||||||||||||
| -0 octal | Specifies the input record separator ($/) as an octal number. If there are no digits, the null character is the separator. Other options may precede or follow the digits. | ||||||||||||||||||||||||||||||||||||||||||||||||
| -I dir | Prepends directory to the search path for modules (@INC) | ||||||||||||||||||||||||||||||||||||||||||||||||
| -m module | Executes use module (); before executing the script. | ||||||||||||||||||||||||||||||||||||||||||||||||
| -M 'module' | executes use module ; before executing the script. | ||||||||||||||||||||||||||||||||||||||||||||||||
| -P | Runs your script through the preprocessor script cppstdin before compilation by perl. | ||||||||||||||||||||||||||||||||||||||||||||||||
| -S | Uses the PATH environment variable to search for the script (unless the name of the script starts with a slash). | ||||||||||||||||||||||||||||||||||||||||||||||||
| -x dir | Tells perl that the script is embedded in a message. | ||||||||||||||||||||||||||||||||||||||||||||||||
| -i extension | specifies that files processed by the <> construct are to be edited in-place. | ||||||||||||||||||||||||||||||||||||||||||||||||
| -e command | Specifies a line of script. | ||||||||||||||||||||||||||||||||||||||||||||||||
| -- | |||||||||||||||||||||||||||||||||||||||||||||||||
| programfile | Name of the perl program | ||||||||||||||||||||||||||||||||||||||||||||||||
| agument |
perl myscript.cgi -d
Run a debug though the CGI / Perl Script myscript.cgi and if any errors are reported stop and report them else wise run through the complete script.
Perl is available in a wide range of operating systems, below is a listing of operating systems which currently support Perl or have planned versions of Perl being released for them. Versions, additional information and downloads can be found at: http://www.perl.com/CPAN/ports/index.html
| AIX | Linux | SCO ODT/OSR | A/UX | MachTen |
| Solaris | BeOS | MPE/iX | SunOS | BSD/OS |
| NetBSD | SVR4 | DG/UX | NextSTEP | Tru64 |
| DomainOS | OpenBSD | Ultrix | DOS DJGPP | OpenSTEP |
| UNICOS | DYNIX/ptx | OS/2 | VMS | FreeBSD |
| OS390 | VOS | HP-UX | PowerMAX | Windows 3.1 |
| Hurd | QNX | Windows 95 | Windows 98 | Windows NT |
| 3b1 | FPS | Plan 9 | AmigaOS | GENIX |
| PowerUX | ConvexOS | Greenhills | RISC/os | CX/UX |
| ISC | Stellar | DC/OSx | MachTen 68k | SVR2 |
| DDE SMES | MiNT | TI1500 | DOS EMX | MPC |
| TitanOS | Dynix | NEWS-OS | UNICOS/mk | EP/IX |
| Opus | Unisys Dynix | Esix | Unixware | BS2000 |
| Netware | Rhapsody | VM/ESA |
See the Perl definition for an example of a Perl script and all related terms.
