Install Perl on Windows 11

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