What is Perl?

In short
Perl is a general-purpose programming language that began as a tool for scanning text files and printing reports. Today developers use it for quick one-liners, system tasks and large applications. It is known for strong regular expressions, good Unicode support and a huge library collection called CPAN.
Perl is a programming language that has been around since the late 1980s. It started life as a tool for reading text, pulling out useful pieces of information and printing reports. Over time it grew into a general-purpose language, and many system administrators, web developers and data engineers still use it every day.
Where Perl came from
The name stands for Practical Extraction and Report Language. The official documentation adds a joke about that name, which is a good hint about the project's spirit. The language was built to be practical. That means easy to use, efficient and complete, rather than small or elegant. The designers borrowed ideas from sed, awk and the Unix shell, so people who already work on Unix-style systems often find it familiar.
Perl still keeps its text-processing roots. Its regular expressions, which are patterns used to match and change text, are among the most capable you will find in any language. Its support for Unicode, the standard that covers characters from almost every writing system, is also very strong.
How it works
Perl is a scripting language. You write a plain text file, then run it with the perl program, and the interpreter reads and executes the code line by line. You do not need a separate compile step before running a script, although Perl does parse the whole file before it starts.
Perl supports several programming styles. You can write simple procedural code, use functions as values in a functional style, or organize your work into objects and classes. This flexibility lets a small script and a large application live in the same language.
A large part of Perl's power comes from its libraries. These are called modules, and they are collected in the CPAN, the Comprehensive Perl Archive Network. Many common problems, such as parsing a file format or talking to a web service, already have a module written for them. You install these modules and load them into your own code.
A simple example
Here is a tiny script that reads lines from standard input and prints only the lines that contain a word:
use strict;
use warnings;
my $word = shift @ARGV;
while (my $line = <STDIN>) {
print $line if $line =~ /\b\Q$word\E\b/;
}
The line with =~ applies a regular expression to each line. The use strict and use warnings lines turn on checks that catch many common mistakes early, and beginners should always include them.
You can also run Perl without a file at all. A one-liner passed with the -e option lets you do quick jobs straight from the command line. This is one reason Perl became popular with system administrators.
Common mistakes
New Perl programmers often forget use strict and use warnings. Without them, a misspelled variable name can fail silently and cause confusing bugs. Another common surprise is that Perl has several kinds of variables, marked by symbols such as $, @ and %, and each one behaves differently. Read the basics before you try to write larger programs.
Perl's flexibility also means that the same task can be written in many ways. Code that is short is not always clear. Aim for readable code, especially on shared projects where other people will maintain it.
Getting started and alternatives
The best first step is to read the official documentation. The perldoc program comes with Perl and gives you offline access to the full manual. Run perldoc perlintro to get a friendly introduction for beginners. The same site also explains perldoc itself, so you can learn how to search and browse the documents.
If you want to compare Perl with other languages, you may enjoy our overview of JavaScript, which is often used for web pages and servers. Our guide to garbage collection explains how some languages reclaim memory automatically, a topic that differs from Perl's own approach. Choose Perl when its text tools, its module collection or its existing codebase fit your task well.
FAQ
Is Perl still used today?
Yes. Perl is still used for system administration, text processing, and some large applications. Many existing systems depend on it, and the language continues to receive new releases.
Do I need to install anything to run Perl?
Perl is available on most Unix-like systems and can be installed on Windows too. Once it is installed, you run scripts with the perl command and read the built-in documentation with perldoc.
What is CPAN?
CPAN is the Comprehensive Perl Archive Network, a large collection of ready-made modules. You can search it and install modules to solve common problems without writing the code yourself.
Is Perl a good first language?
It can be, especially if you want to work with text or system tasks. Beginners should start with perlintro and always use strict and warnings to catch mistakes early.
Sources
This page is based on the official documentation below. Read it for full detail.
Perl — official documentation ↗