Perl

term

programmingops culture

Kept in this browser · My desk

Larry Wall's language for scanning text files, extracting information and printing reports, version 1.000 dated 18 December 1987; it "officially stands for Practical Extraction and Report Language, except when it doesn't".

Its manual says it combines features of sed, awk and sh and quickly became a good language for system management; the Computer History Museum records its nickname, "the duct tape of the Internet".

What it is. Perl is a dynamically typed, interpreted language written by Larry Wall, "originally a language optimized for scanning arbitrary text files, extracting information from those text files, and printing reports", in the words of its own manual, which describes it as practical (easy to use, efficient, complete) rather than beautiful (tiny, elegant, minimal). It combines features of C, sed, awk and sh, and the manual still boasts "some of the most powerful regular expressions to be found anywhere" and Unicode support it calls world-class.

How it works. Perl has three main variable types, each marked by a sigil: scalars, arrays and hashes. Its operators decide how values are read rather than the values themselves: the arithmetic operators impose numeric context and the string operators string context, so "10" + 1 is 11 and string joining needs its own operator, the binary dot, which concatenates two strings. Even auto-increment has "a little extra builtin magic": applied to a variable that has only been used as a string, it increments the string. Perl put regular expressions into a language's syntax, and its engine finds matches by backtracking; the perlre manual warns that particularly complicated patterns "can take exponential time to solve" and offers possessive quantifiers and independent subexpressions so that the engine does not backtrack where it should not. Modules come from the Comprehensive Perl Archive Network (CPAN).

Origin and releases. The perlhist record dates Perl 1.000 to 18 December 1987, 2.000 to 5 June 1988, 3.000 to 18 October 1989, 4.000 to 21 March 1991 and 5.000 to 17 October 1994. Perl 5 has been the language ever since: 5.6.0 came on 22 March 2000, 5.8.0 on 18 July 2002, 5.10.0 on 18 December 2007, 5.26.0 on 30 May 2017, 5.36.0 on 27 May 2022, 5.42.0 on 3 July 2025 and Perl 5.44.0 was released on 15 July 2026. The language once announced as Perl 6 is a separate project: the Raku documentation says "Perl 6" was its name before October 2019 and that the two are sister languages, Raku not being intended to replace Perl.

Standards and status. Perl has no external standard; the implementation and its documentation define the language. The perlpolicy document, the written policy of the Perl 5 Porters, over whom Larry Wall presides with the final word, sets the numbering: even minor numbers (5.40, 5.42) are stable series, odd ones (5.41, 5.43) are development series with a release roughly every month, and a new stable series typically comes once a year. As of the release of 5.44, it lists 5.44.x (from 15 July 2026) and 5.42.x (from 3 July 2025) with full support, 5.40.x (from 9 June 2024) with security fixes only, and every older stable series as end of life.

Where it shows up. Perl carried a generation of system administration and early web scripts, Common Gateway Interface (CGI) programs among them; the Computer History Museum records its nickname, "the duct tape of the Internet". The perlintro manual says it is now used for system administration, web development, network programming and graphical interfaces, among other tasks, which is why administrators still meet it in scripts nobody remembers writing.

What goes wrong, and what Perl does about it. Perl was designed to make it easier to write programs that run with extra privileges. Its taint mode, described in perlsec, switches on automatically when real and effective user or group identifiers differ (the Unix setuid bit is mode 04000, setgid 02000), and the -T flag turns it on explicitly; the manual strongly suggests it for server programs and Common Gateway Interface scripts. With taint on, command line arguments, environment variables, locale information and all file input are marked tainted and cannot be used, directly or indirectly, in a command that invokes a sub-shell or modifies files, directories or processes until the program launders them through a regular expression. Hash keys are never tainted, and since Perl 5.18 perl can be built with taint support compiled out, so the protection depends on how the interpreter was built. The module search path was another hole: until 5.26, @INC ended with the current directory, so a script loading an optional module from an untrusted directory such as /tmp could load and run code from there; since v5.26 the current directory is always removed by default. Regular expressions written for convenience become denial-of-service bugs when attackers control the input, the backtracking problem perlre warns about.

Neighbours. Regular expressions and ReDoS; the shell, sed and awk it absorbed; Python, PHP and Ruby, which inherited its job (Ruby's name is a jewel chosen in Perl's wake); interpreters in general.

Also known as: practical extraction and report language, perl 5

Sources

← Back to P Back to the glossary