What is a .pl file?
Perl Script · Code and data · Larry Wall · 1987
A .pl file is a Perl script, a scripting language famous for text processing, system administration and the early dynamic web. A .pm file is a Perl module, a reusable library the scripts load.
What is a .pl file used for?
Perl earned the nickname 'the duct tape of the internet': it powered CGI scripts, log crunching and sysadmin glue for decades, and its regular-expression engine influenced almost every later language. Countless servers still run Perl daily.
The files are plain text and usually start with a #!/usr/bin/perl line on Unix systems. Note the extension clash: .pl is also used for Prolog source, so a file that looks nothing like Perl may be Prolog.
How to open a .pl file
The .pl format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list. For a step-by-step walkthrough, see how to open a .pl file.
Windows
- Strawberry Perl
- VS Code
- any text editor
macOS
- Terminal (perl)
- VS Code
- any text editor
Linux
- perl (preinstalled)
- VS Code
- any text editor
.pl file signature (magic bytes)
Programs recognise a .pl file by the bytes at the start of the file, not by its name. These are the signatures for Perl.
| Hex signature | Offset | Note |
|---|---|---|
| (no fixed signature) | 0 | plain text; no fixed magic bytes |
See the full magic-numbers reference for every format.
Frequently asked questions
What is a .pl file?
A .pl file is a Perl script, a scripting language famous for text processing, system administration and the early dynamic web. A .pm file is a Perl module, a reusable library the scripts load.
How do I run a .pl file?
With Perl installed, run perl file.pl from a terminal. On Linux and macOS Perl is usually preinstalled; on Windows, Strawberry Perl is the common distribution.
What is the difference between .pl and .pm?
A .pl file is a runnable Perl script; a .pm file is a Perl module, a library of functions that scripts pull in with use or require.
Is .pl always Perl?
Usually, but not always: Prolog source files also use .pl. If the file is full of $variables and regular expressions it is Perl; clauses ending in periods suggest Prolog.
Related formats
Sources
Details on this page were checked against authoritative references: