perl
developmentLinux/Unix
The perl command is one of the most frequently used commands in Linux/Unix-like operating systems. perl The Perl 5 language interpreter
Quick Reference
Command Name:
perl
Category:
development
Platform:
Linux/Unix
Basic Usage:
perl [options] [arguments]
Common Use Cases
Syntax
perl [options] [program_file] [arguments]
Options
Option | Description |
---|---|
-0[octal/hex] |
Specify record separator ($/) as octal/hexadecimal |
-a |
Autosplit mode with -n or -p (splits $_ into @F) |
-C[number/list] |
Control Unicode features |
-c |
Check syntax only, without executing |
-d[:debugger] |
Run program under debugger |
-D[number/list] |
Set debugging flags |
-e 'command' |
Execute one line of program |
-E 'command' |
Execute one line of program with all features enabled |
-f |
Don't do $sitelib/sitecustomize.pl |
-F/pattern/ |
Split on pattern with -a (instead of whitespace) |
-i[extension] |
Edit files in place (make backup with extension) |
-Idirectory |
Add directory to include path (@INC) |
-l[octal] |
Enable line ending processing, specifying output record separator |
-m[-]module |
Execute 'use/no module' before executing program |
-M[-]module |
Execute 'use/no module' at beginning of program |
-n |
Loop around reading each line, not implying 'print' |
-p |
Loop around reading each line, with 'print' at end of loop |
-s |
Enable rudimentary switch parsing for switches after programfile |
-S |
Look for program in PATH environment variable |
-t |
Enable tainting warnings |
-T |
Enable tainting checks |
-u |
Dump core after compiling |
-U |
Allow unsafe operations |
-v |
Print version, patchlevel and license information |
-V[:variable] |
Print configuration information or specific variable |
-w |
Enable many useful warnings |
-W |
Enable all warnings |
-x[directory] |
Extract Perl program from input (optionally CD to directory) |
-X |
Disable all warnings |
Examples
How to Use These Examples
The examples below show common ways to use the perl
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
# Basic Examples Basic
perl -e 'print "Hello, World!\n"'