perl: command not found
perl: command not found
DodaTech
2 min read
The “perl: command not found” error means your operating system cannot locate the Perl interpreter in any directory listed in your PATH environment variable.
What It Means
When you type perl in your terminal, the shell searches through every directory in your PATH variable to find an executable named perl. If none of those directories contain the Perl binary, the shell returns “command not found.” Perl is not installed by default on most systems — it must be installed separately.
Why It Happens
- Perl is not installed on your system.
- Perl is installed but its binary directory (e.g.,
/usr/binor/usr/local/bin) is not in yourPATH. - You’re using a minimal Docker container or WSL image that doesn’t include Perl.
- The installation was incomplete or corrupted.
- You opened a new terminal session that hasn’t loaded the updated PATH.
How to Fix It
1. Install Perl via your package manager
Ubuntu / Debian:
sudo apt update
sudo apt install perlCentOS / RHEL / Fedora:
sudo dnf install perl
# or on older systems
sudo yum install perlmacOS (Homebrew):
brew install perlWindows (Chocolatey):
choco install perl2. Verify the installation
perl --version
# Expected output (version may vary):
# This is perl 5, version 38, subversion 2 (v5.38.2)3. Check your PATH if Perl is installed but not found
# Locate the Perl binary
which perl
# or
find /usr -name perl -type f 2>/dev/null
# If found, add its directory to your PATH
export PATH="$PATH:/usr/local/bin/perl"
# Add to ~/.bashrc or ~/.zshrc for permanence4. Restart your terminal session
After installing, close and reopen your terminal or run:
exec $SHELL -l5. For Docker containers
If Perl is missing from your Docker image, add it to your Dockerfile:
RUN apt-get update && apt-get install -y perlBuilt by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro