.PM

PM File

Perl Module File
Ask a question
QUICK ANSWER

A PM file is a Perl module - a plain-text file of Perl source code that packages reusable functions and variables for other Perl programs to load with 'use'. Open it in any text editor (VS Code, Notepad++, vim) to read or edit the code. To run code that uses it you need Perl, which ships with macOS and Linux; on Windows install Strawberry Perl. A .pm is a library, not a standalone script - it is loaded by a .pl file, not run on its own.

Developer: Larry Wall / The Perl Foundation (Perl programming language) Category: Developer Files Open standard MIME: text/x-perl
OPENS ON Windows macOS Linux
Related: .DO · .MD · .HEX · .XSD

On this page

19k+ extensions indexed
Last reviewed Jun 30, 2026

Not sure what your file is?

Drop any file into our identifier - we read just the first bytes to name the format.

Identify a file

What is the PM file format?

A .pm file is a Perl module - a plain-text source file that packages reusable Perl code into a named namespace. The module system was introduced with Perl 5 in 1994 and remains the foundation of the CPAN ecosystem, which hosts hundreds of thousands of .pm modules.

Every .pm file declares its namespace near the top with a package statement (e.g., package HTTP::Tiny;) and conventionally ends with a bare 1; so that use or require can verify a successful load. There is no binary magic number; the file is identified by its .pm extension and the presence of a package declaration.

Module name and file path are directly linked: Foo::Bar maps to Foo/Bar.pm somewhere on Perl's @INC search path. A module is loaded by a .pl script or another module with use Module::Name; or require "Module/Name.pm".

Typical contents include:

  • Exported subroutines and variables (usually managed with Exporter)
  • Object-oriented class definitions
  • Embedded .pod documentation blocks
  • A version declaration via our $VERSION = '1.00';

Modules are interpreted at run time; .pmc files are an optional byte-code cache. The MIME type is text/x-perl and the encoding is usually UTF-8 or ASCII, declared with use utf8; when needed.

Security & safety

RISK: MEDIUM

A .pm file is plain text and safe to read or open in an editor - it cannot act by itself. The risk is in RUNNING it: Perl modules are executable code that can read/write files, run shell commands and make network calls, and code can even run at load time (BEGIN blocks, import logic) the moment a script does 'use Module;'. So treat an untrusted .pm like any program: read it before you load it, and don't run Perl code from sources you don't trust. The file sitting on disk is harmless.

Format details

in a nutshell
FULL NAMEPerl Module Fileaka Perl module, Perl library file
DEVELOPERLarry Wall / The Perl Foundation (Perl programming language)since 1987 (Perl 1.0); the .pm module convention dates to Perl 5 (1994)
MIME TYPEtext/x-perl
TYPEPlain-text Perl source code (reusable module/package)
STANDARDOpen · royalty-free
This extension is also used by…
  • Adobe PageMaker publication (.pm) - Older Aldus/Adobe PageMaker desktop-publishing documents used the .pm extension (later .pm5/.pm6/.p65/.pmd); open/convert in Adobe InDesign.

Programs that open PM files

Windows4 apps
Notepad Open-source Open the .pm as text with Perl syntax highlighting to read or quickly edit (no execution).
Perl (Strawberry Perl) Open-source Install Strawberry Perl, then run a script that loads the module ('perl script.pl') or test it with 'perl -c Module.pm' to syntax-check.
Visual Studio Code (with Perl extension) Free Open the .pm to edit with syntax highlighting and (via the Perl Navigator/Language Server) linting and go-to-definition.
Padre (legacy Perl IDE) Open-source Old dedicated Perl IDE; usable but largely unmaintained - prefer VS Code for new work.
macOS3 apps
TextMate Open-source Open the .pm as text with Perl syntax highlighting for reading/editing.
Perl (built-in / Perlbrew) Open-source macOS ships Perl; run scripts with 'perl', or use Perlbrew to manage versions. Syntax-check a module with 'perl -c Module.pm'.
Visual Studio Code (with Perl extension) Free Edit the .pm with the Perl Navigator extension for linting and navigation.
Linux2 apps
Perl (built-in) Open-source Perl is preinstalled on virtually all Linux. Run scripts that 'use' the module, or 'perl -c Module.pm' to check it; 'perldoc Module.pm' reads its POD docs.
GNU Emacs / Vim Open-source Open the .pm in cperl-mode/Emacs or Vim for full-featured Perl editing.

Technical details

deep spec
MIME typetext/x-perl (also accepted: application/x-perl, text/plain)
EncodingUTF-8 or ASCII; non-ASCII source requires an explicit `use utf8;` declaration
File structure`package` declaration → imports (`use`/`require`) → subroutines and variables → optional `Exporter` setup → embedded POD docs → trailing true value (`1;`)
Magic bytes / signatureNone; no binary signature. Identified by the `.pm` extension and a `package` statement near the top. An optional UTF-8 BOM (EF BB BF) may precede the first line.
Namespace-to-path mappingModule name maps directly to its file path: `Foo::Bar` resolves to `Foo/Bar.pm` on Perl's `@INC` search path
Loading mechanismCompile-time loading via `use Module;`; run-time loading via `require 'Module/Name.pm'` or `require Module::Name`
True-value terminatorMust end with a true value - conventionally bare `1;` - so the caller can confirm the file loaded without error
Version targetingMinimum Perl version declared with `use v5.xx;` or `use 5.010;`; no file-format version of its own
Typical file size1 KB - 200 KB per module
Export mechanismSubroutines and variables are selectively exposed to callers via the `Exporter` module using `@EXPORT` and `@EXPORT_OK` arrays
Documentation embeddingInline Plain Old Documentation (POD) blocks, delimited by `=pod` / `=cut`; parsed by `perldoc` and POD renderers
Byte-code cachePerl may store a pre-compiled form alongside the source as a `.pmc` file; the `.pm` itself is never compiled to a standalone binary
Obfuscation / encryptionPlain text by default; optional source filtering via modules such as `Filter::Crypto` or `Filter::Util::Call`
Associated platformsLinux, macOS, Windows (Strawberry Perl / ActivePerl), and any other OS where Perl is installed
Released1987 (Perl 1.0); the .pm module convention dates to Perl 5 (1994)
Latest versionPerl 5.40 (2024); Perl modules remain the standard library packaging unit
Open standardYes · royalty-free
Specificationperldoc.perl.org

PM conversions

Community Q&A

asked by users
Ask a quick question
Get help from people who work with PM files. Be specific - include your system and software version.
No account needed · answers usually within a day

No questions yet - be the first to ask about PM files.

Frequently asked questions

What is a .pm file?
A Perl module - a plain-text file of Perl source code that packages reusable functions/variables for other Perl programs to load with 'use'. It's a library, not a standalone program.
How do I open a .pm file?
Any text editor reads it (Notepad++, VS Code, vim). To use the code you need Perl installed (built into macOS/Linux; Strawberry Perl on Windows) and a script that does 'use Module;'. Syntax-check it with 'perl -c Module.pm'.
How do I run a .pm file?
You don't run a module directly - it's loaded by a Perl script. Write or run a .pl script that does 'use Your::Module;' (the module must be on Perl's @INC path), then execute the script with 'perl script.pl'.
Is a .pm file the same as a .pl file?
Both are Perl source. A .pl is a runnable script (often with a #! shebang); a .pm is a reusable module (a 'package' ending in '1;') meant to be loaded by other code, not run on its own.
Do I need Perl to open a .pm file?
Only to run it. To read or edit the code, any text editor is enough. macOS and Linux already include Perl; on Windows install Strawberry Perl to execute code that uses the module.
How do I read the documentation in a .pm file?
Perl modules embed docs in POD format. Run 'perldoc Module.pm' to read it formatted, or convert it with pod2html/pod2pdf. You can also just open the .pm and scroll to the '=pod' sections.

References

1perldoc - perlmod (Perl modules)perldoc.perl.org
2Perl.org - official sitewww.perl.org

Keep exploring

across the database

Top extensions this week

1.AQQAQQ Instant Messenger File
2.MDMarkdown Document
3.CRDOWNLOADChrome Partial Download File
4.BINCD/DVD Disc Image (BIN/CUE)
5.PARTPartial Download File
6.NOMEDIAAndroid No-Media Marker File
7.RPMSGRestricted Permission Message
8.EXEWindows Executable (Portable Executable)
9.AVIFAV1 Image File Format (AVIF)
10.SB3Scratch 3.0 Project File

Related extensions

.DOStata Do-File
.MDMarkdown Document
.HEXIntel HEX File
.XSDXML Schema Definition
.MAPSource Map (JavaScript / CSS)
.CONFIGConfiguration File

Free file tools

An in-browser file identifier and image converter - everything runs on your device.

Open the toolbox

Browse file extensions A-Z