Install Perl on Windows 11

Contents
Strawberry Perl
Check the install
cpanm and modules
The WSL alternative

Strawberry Perl

Windows does not ship a usable Perl, so you install one. Strawberry Perl is the standard choice: a single MSI, a real gcc for building XS modules, and cpanm included.

Download the 64-bit MSI from strawberryperl.com and run it. The defaults are fine: it installs to C:\Strawberry and adds that folder to the system PATH.

Close every open terminal after the installer finishes. A shell that was already running keeps the old PATH and will claim that perl is not recognised.

Check the install

Open a new PowerShell or Command Prompt window and ask for the version. The output names the release, the build date and the platform:

perl -v

This is perl 5, version 40, subversion 0 (v5.40.0) built for MSWin32-x64-multi-thread

Anything from 5.26 upwards runs every example in this course. If the command is not found, the PATH did not update: check C:\Strawberry\perl\bin in the environment variables, or reinstall and reboot.

Run one line of code to confirm the whole chain works:

perl -e "print qq{hello from Perl\n}"

hello from Perl

Double quotes are the outer quoting on Windows, which is why this one-liner uses qq{} inside instead of single quotes.

cpanm and modules

Strawberry bundles cpanm, the installer used in lesson 32. Check that it answers:

cpanm --version

cpanm (App::cpanminus) version 1.7047

From here, installing a module is one command. The first one you need for later lessons is Text::CSV, which pulls in its own dependencies:

cpanm Text::CSV

Some modules need a C compiler. Strawberry includes one, so the build works without Visual Studio. If a module fails, read the first error in the log rather than the last: the last line only says the build stopped.

The WSL alternative

If you also work on Linux servers, install Windows Subsystem for Linux and use its Perl instead. The commands then match the Ubuntu lesson exactly, which makes copying examples from documentation painless.

wsl --install -d Ubuntu

After the reboot and the first-run setup, open the Ubuntu terminal and install Perl. It is usually already there:

sudo apt update

sudo apt install perl

Files live in the Linux filesystem, which is faster than editing them through /mnt/c. Keep the course folder under your home directory inside WSL, and run perl -v there to confirm.

Next: Install Perl on Ubuntu

Article author: Arthur Isaev

Related articles
Perl
Perl course: zero to hero in 50 lessons
What is Perl and where it runs
Install Perl and check the version
Your first Perl script
The debugger as a REPL
Scalars and sigils
Numbers
Strings
Interpolation and quoting
Arrays
push, pop, shift and splice
Hashes
keys, values, exists and delete
Scalar and list context
Conditions and comparison
while, for, next and last
foreach and the default variable
Subroutines
Arguments in @_
References
Nested data structures
Regular expressions: match and anchors
Captures and named groups
Substitution with s///
split and join
grep and map
Sort and the Schwartzian transform
Read and write files
File tests and metadata
Directories and paths
die, warn and eval
Modules and Exporter
CPAN and cpanm
Objects with bless
Modern objects with Moo
Testing with Test::More
strict, warnings and diagnostics
Options with Getopt::Long
Environment and %ENV
system, backticks and pipes
One-liners with -n and -p
CSV and TSV processing
JSON with JSON::PP
HTTP clients with HTTP::Tiny
Sockets and IO::Socket
Databases with DBI
Capstone: todo CLI
Capstone: log report
Performance and profiling
Modern Perl tour
Hero roadmap: the whole course on one page
Install Perl on Windows 11
Install Perl on Ubuntu
Install Perl on Rocky Linux
Install Perl on macOS
Install Perl on FreeBSD
Perl in Docker

Search this site

Channel @aofeed Chat @aofeedchat

Contacts and cooperation:
I recommend our hosting beget.com
Write to info@aredel.com if you:
1. Want to write an article for our site or translate an article into your native language.
2. Want to place thematically relevant ads on the site.
3. Ads on my site pass maximum censorship. If you see an ad block unsuitable for school-age children, shocking or misleading - please contact us by e-mail
4. Found a mistake, inaccuracy, bug, etc. on the site. ... .......
5. Articles can be shared on social media by clicking a network icon: