Perl Installation On A Debian, Ubuntu, Alpine, Arch, Kali, CentOS, Fedora, Raspbian And MacOS

Perl Installation On A Debian, Ubuntu, Alpine, Arch, Kali, CentOS, Fedora, Raspbian And MacOS

perl

The Perl 5 language interpreter.

Maintainer: Niko Tyni



Section: perl

Install perl

  • Debian apt-get install perl-base Click to copy
  • Ubuntu apt-get install perl-base Click to copy
  • Alpine OS apk add perl Click to copy
  • Arch Linux pacman -S perl Click to copy
  • Kali Linux apt-get install perl-base Click to copy
  • CentOS yum install perl-base Click to copy
  • Fedora dnf install perl-base Click to copy
  • Raspbian apt-get install perl-base Click to copy
  • macOS brew install perl Click to copy

The Perl 5 language interpreter.

How to use perl?

Below are few example commands for perl that you can use in the terminal.

Parse and execute a Perl script:
perl script.plClick to copy
Check syntax errors on a Perl script:
perl -c script.plClick to copy
Parse and execute a perl statement:
perl -e perl_statementClick to copy
Run a Perl script in debug mode, using `perldebug`:
perl -d script.plClick to copy
Loo[p] over all lines of a file, editing them [i]n-place using a find/replace [e]xpression:
perl -p -i -e 's/find/replace/g' filenameClick to copy
Run a find/replace expression on a file, saving the original file with a given extension:
perl -p -i'.old' -e 's/find/replace/g' filenameClick to copy
Run a multi-line find/replace expression on a file, and save the result in another file:
perl -p0e 's/foo bar/foobar/g' input_file > output_fileClick to copy
Installing perl command is simple. just copy one of the above commands for your operating system and paste it into terminal. This command is available for Debian, Ubuntu, Alpine, Arch, Kali, CentOS, Fedora, Raspbian and macOS operating systems. Once you run the command it will install the latest version of perl 2026 package in your OS.