.pl

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.

Category
Code and data
MIME type
Type
Plain text
Also seen as
.pm
Is a .pl file safe to open? Caution. A .pl file is a script that can do anything the interpreter allows, including changing files. Read unfamiliar scripts before running them.

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.

What opens 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.

Windows

  • Strawberry Perl
  • VS Code
  • any text editor

macOS

  • Terminal (perl)
  • VS Code
  • any text editor

Linux

  • perl (preinstalled)
  • VS Code
  • any text editor

Open a .pl file step by step

  1. Confirm the file really is a .pl. Drop it into the WhatFileType identifier, which reads its signature in your browser without uploading anything.
  2. On Windows, open it with Strawberry Perl or VS Code.
  3. On Mac, use Terminal (perl) or VS Code.
  4. On Linux, try perl (preinstalled) or VS Code.
  5. Still stuck? Search for a dedicated Perl viewer rather than a generic one.

Why can't I open my .pl file?

Almost always because no installed app understands Perl. Install one of the apps above, or convert the file to a format your existing software already reads. If double-clicking opens the wrong program instead of nothing at all, the file association is set to the wrong app rather than the file being broken.

The other possibility is that the file is not really a .pl at all. Drop it into the file identifier to check it by its bytes instead of its name. Nothing is uploaded.

Perl has no fixed magic number, so there is no signature table on this page. Its bytes alone do not prove the format: identification relies on the extension, the structure of the content and the program that created it. The magic-numbers reference lists the formats that do carry one.

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. How sources are ranked and what is deliberately left out is set out in the methodology.