User Tools

Site Tools


About PERL - Practical Extraction and Report Language

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, -D14 turns on the Trace Execution, Label Stack Processing, and Stack Snapshots flags) or a list of the letters associated with those flags (for example, -Dtls is the same as -D14). Another nice value is -Dx, which lists your compiled syntax tree. And -Dr displays compiled regular expressions. The available flags are: 1 p Tokenizing and parsing 2 s Stack snapshots 4 l Lable stack processing 8 t Trace execution 16 o Operator node construction 32 c String/numeric conversions 64 p Print processor command for -P 128 m Memory allocation 256 f Format processing 512 r Regular expression parsing 1024 x Syntax tree dump 2048 u Tainting checks 4096 L Memory leaks (not supported with later versions) 8192 H Hash dump – usurps values () 16384 X Scratchpad allocation 32768 D Cleaning up

  • -p assumes the following loop around your script.
while (<>) { 
# your script goes here 
} continue { 
print or die "-p destination: $!\n"; 
  • -n Assumes the following loop around your script.
while (<>) {
# your script goes here
  • -a Turns on autosplit mode when used with a -n or -p.
  • -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



perl myscript.cgi -d - Would 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.


Versions, additional information and downloads can be found at:

handbook/handbook/perl4.txt · Last modified: 2010/04/15 21:18 (external edit)