LinuxCommandLibrary

perl

TLDR

Run Perl script

$ perl [script.pl]
copy
Execute one-liner
$ perl -e 'print "Hello\n"'
copy
In-place edit
$ perl -i -pe 's/old/new/g' [file]
copy
Print with autosplit
$ perl -ane 'print $F[0]' [file]
copy
Check syntax
$ perl -c [script.pl]
copy
Enable warnings
$ perl -w [script.pl]
copy

SYNOPSIS

perl [options] [program] [arguments]

DESCRIPTION

perl is the Perl interpreter. Practical Extraction and Report Language.
The language excels at text processing. Powerful regex support.
perl runs Perl programs.

PARAMETERS

PROGRAM

Perl script file.
-e CODE
Execute code.
-n
Loop over input.
-p
Loop and print.
-i EXT
In-place edit.
-w
Enable warnings.
-c
Syntax check only.

CAVEATS

Perl 5 primarily. Use strict/warnings. CPAN for modules.

HISTORY

Perl was created by Larry Wall in 1987 for text manipulation.

SEE ALSO

python(1), ruby(1), awk(1)

Copied to clipboard