Skip to main content

Perl

Updated 2 min read

Share this page

Send the link, quote the definition with a link back, or show it as a card on your own site.

https://softwaredictionary.org/terms/perl

In short

Perl is a mature, dynamic scripting language famous for text processing and built-in regular expressions, long used for system administration and web scripts.

What is Perl?

Perl is a general-purpose scripting language created by Larry Wall and first released in 1987 to make report processing and text manipulation easier on Unix systems. The name is often expanded as "Practical Extraction and Report Language", though that expansion was coined after the name. Perl 5 is what most people mean by Perl today; the project once called Perl 6 grew into a separate language and was renamed Raku in 2019.

Perl is dynamically typed and uses sigils, symbols in front of variable names, to show what kind of data they hold: $ for a single value, @ for an array and % for a hash (a dictionary). Regular expressions are built into the syntax rather than added through a library, which makes searching, extracting and rewriting text very concise. Its motto, "there's more than one way to do it", reflects a flexible design, and CPAN, the Comprehensive Perl Archive Network, has hosted reusable modules since 1995.

Perl was nicknamed the "duct tape of the internet" in the 1990s, when it powered many early dynamic websites through CGI scripts. Today it is used for system administration, log and text processing, bioinformatics and maintaining large existing codebases, and it comes preinstalled on many Linux and Unix systems. Its regex syntax was so influential that the PCRE library, short for Perl Compatible Regular Expressions, is used by many other languages and tools.

Perl is often compared with Python and Ruby, which took over many of its scripting roles. Ruby was directly influenced by Perl and shares its expressive, flexible style, while Python deliberately chose a stricter "one obvious way" philosophy that many find easier to read in large programs. Perl's compact syntax is powerful for one-off text tasks but can be hard to read later, which is why it is sometimes jokingly called a "write-only" language.

Key takeaways

  • Perl is a dynamic scripting language built for text processing.
  • Regular expressions are part of the core syntax.
  • Sigils like $, @ and % mark scalars, arrays and hashes.
  • CPAN provides a large archive of reusable Perl modules.
  • Perl 6 was renamed Raku and is a separate language from Perl 5.

Example

Counting status codes in a log with Perlperl
#!/usr/bin/perl
use strict;
use warnings;

# Count HTTP status codes in a web server log read from standard input
my %count;
while (my $line = <STDIN>) {
    $count{$1}++ if $line =~ /" (\d{3}) /;
}

for my $status (sort keys %count) {
    print "$status: $count{$status}\n";
}

Readers ask

Is Perl still used?

Yes, though less often for new projects than in the 1990s and 2000s. Perl 5 is still actively maintained, ships with many Unix-like systems and runs a large amount of existing system administration, text processing and web code.

What is the difference between Perl and Raku?

Raku began as Perl 6, a redesign of the language, but grew so different that it was renamed in 2019. Perl 5 continues as Perl, and the two are separate languages with separate communities.

Why is Perl good for text processing?

Regular expressions, string operators and file handling are built directly into the language, so tasks like filtering logs or rewriting files often take only a few lines. Command-line flags also let you run Perl one-liners straight from the shell.

See also

Spotted a mistake or something missing on this page?Suggest an edit

Read a random page
Open today's review
Switch to the dark theme
Read this page in Türkçe

More

Settings