Fedora packages Perl as a split runtime instead of assuming every system needs the full toolchain. To install Perl on Fedora, most readers should use the perl package, which brings in the interpreter, core modules, cpan client, documentation, and development files from Fedora’s standard repositories.
Use perl-interpreter only when an existing script needs /usr/bin/perl and you want the smallest package surface. Fedora’s perl package requires perl-CPAN, so treat CPAN as part of the full install surface; Fedora-packaged modules are still the cleaner default because DNF owns their updates and removal.
Install Perl on Fedora
Fedora’s Perl package metadata lists the current stable package and shows that perl provides the perl-core name. Use perl in commands because it is the real package name you will see in RPM queries.
| Package or Provide | What It Installs | Best For |
|---|---|---|
perl or perl-core | Full core Perl environment, /usr/bin/perl, cpan, documentation, and development files | Development work, scripts that need core modules, and the best default for most systems |
perl-interpreter | Standalone /usr/bin/perl runtime with a smaller dependency set | Running existing scripts when you do not need the full core-module package set |
perl-CPAN | The /usr/bin/cpan client required by the full perl package | Moving from the minimal interpreter to the full CPAN-capable package surface |
The full perl package is the better default unless you know you only need the standalone interpreter. It includes the CPAN client through perl-CPAN, while perl-interpreter keeps the package surface smaller.
Refresh Fedora Before Installing Perl
Start with a refresh so DNF reads current Fedora package metadata and applies pending updates before Perl is installed.
sudo dnf upgrade --refresh
These commands use
sudofor tasks that need root privileges. If your account is not in the sudoers file yet, follow the guide to add a user to sudoers on Fedora.
Install the Full Perl Package
Install the full Fedora Perl package when you want the interpreter, bundled core modules, CPAN client, documentation, and development files managed together by DNF.
sudo dnf install perl
Verify that Perl can run code and that the installed package satisfies the perl-core provide:
perl -e 'print "Perl works\n"'
perl -e 'printf "%vd\n", $^V'
rpm -q --whatprovides perl-core --qf '%{NAME}\n'
rpm -q perl-CPAN --qf '%{NAME}\n'
test -x /usr/bin/cpan && echo "/usr/bin/cpan"
Perl works 5.42.2 perl perl-CPAN /usr/bin/cpan
The exact Perl version and package revision can change with Fedora updates, but the check proves that the installed perl package owns the perl-core name that appears in older Fedora Perl instructions.
Install the CPAN Client
The cpan command lives in perl-CPAN, and Fedora’s full perl package requires it. If you installed the minimal interpreter first and later need CPAN, installing perl-CPAN moves the system to the full Perl package surface because DNF adds perl as a dependency.
sudo dnf install perl-CPAN
Confirm that the CPAN package is installed and the client is on your PATH:
rpm -q perl-CPAN --qf '%{NAME}\n'
test -x /usr/bin/cpan && echo "/usr/bin/cpan"
perl-CPAN /usr/bin/cpan
Install Only the Standalone Perl Interpreter
Use this smaller package when you only need /usr/bin/perl to run existing scripts and do not need the full core-module package set.
sudo dnf install perl-interpreter
On a system where only perl-interpreter was installed, the package is present and the interpreter works, but the CPAN client is absent:
rpm -q perl-interpreter --qf '%{NAME}\n'
perl -e 'print "Perl works\n"'
command -v cpan || echo "cpan not installed"
perl-interpreter Perl works cpan not installed
Install Perl Modules on Fedora
Fedora packages many Perl modules as RPMs, and DNF can resolve them by Perl namespace. Fedora’s Perl modules documentation recommends this path when a module is available because updates stay aligned with the rest of the system.
Find the Fedora Package That Provides a Perl Module
Query the repositories with the Perl namespace first so you do not have to guess the RPM package name. Current Fedora 44 metadata returns package rows like these; later Fedora updates can change the release suffix.
dnf -q repoquery --whatprovides 'perl(DateTime)'
dnf -q repoquery --whatprovides 'perl(DBD::mysql)'
perl-DateTime-2:1.66-5.fc44.x86_64 perl-DBD-MySQL-0:5.013-2.fc44.x86_64
Once you know the provider, install the module directly through DNF:
sudo dnf install 'perl(DateTime)'
Confirm that Perl can load the module:
perl -MDateTime -e 'print DateTime->VERSION, qq(\n)'
1.66
Use Fedora-packaged modules first whenever they exist. CPAN modules can work well, but binary modules may need rebuilding after a Fedora release upgrade because Perl does not keep binary compatibility across major Perl versions.
If Fedora does not package the module you need, use the cpan client from perl-CPAN and follow the module’s upstream instructions as a CPAN-managed exception. Avoid sudo cpan for normal workstation use unless you deliberately want system-wide CPAN changes.
Run a Quick Perl Test on Fedora
A one-line script confirms that Perl can execute code without creating temporary files.
perl -e 'print qq(Hello, world!\n)'
Hello, world!
This simple check is also useful after Fedora package updates or after switching between perl and perl-interpreter.
Troubleshoot Perl on Fedora
Fix “Can’t locate DateTime.pm in @INC”
This error means the Perl interpreter is working, but the module you need is not installed in Fedora’s Perl paths.
Can't locate DateTime.pm in @INC (you may need to install the DateTime module)
Find the matching Fedora package first:
dnf -q repoquery --whatprovides 'perl(DateTime)'
perl-DateTime-2:1.66-5.fc44.x86_64
The provider row may show a different Fedora release suffix after updates. Install the provider, then verify that Perl can load the module:
sudo dnf install 'perl(DateTime)'
perl -MDateTime -e 'print DateTime->VERSION, qq(\n)'
1.66
Fix “cpan: command not found”
This happens when only the minimal perl-interpreter package is installed, or when perl-CPAN was removed during a package change. The full perl package normally installs the CPAN client.
bash: cpan: command not found
Install perl-CPAN:
sudo dnf install perl-CPAN
Verify the package and command path:
rpm -q perl-CPAN --qf '%{NAME}\n'
test -x /usr/bin/cpan && echo "/usr/bin/cpan"
perl-CPAN /usr/bin/cpan
Update or Remove Perl from Fedora
Update Perl with DNF
Fedora updates installed Perl packages through normal DNF upgrades. Use a full system refresh so related module packages, the interpreter, and the CPAN client stay on compatible builds.
sudo dnf upgrade --refresh
Remove the Full Perl Package
If you installed the full perl package, remove it first with DNF. Fedora can remove perl-CPAN with it because the full package requires the CPAN client package.
sudo dnf remove perl
Verify that the package is gone:
rpm -q perl
package perl is not installed
If command -v perl still returns /usr/bin/perl, another installed package still depends on perl-interpreter. Removing the full package alone does not guarantee that the standalone interpreter can be removed safely.
Remove the CPAN Client and Full Perl Surface
Remove perl-CPAN only when you are also willing to remove the full perl package that depends on it. Read the DNF transaction summary before accepting the removal.
sudo dnf remove perl-CPAN
Verify that both packages are gone, then clear the current shell’s command cache before checking PATH:
rpm -q perl perl-CPAN
hash -r
command -v cpan || echo "cpan not installed"
package perl is not installed package perl-CPAN is not installed cpan not installed
Remove the Standalone Perl Interpreter
Read the DNF transaction summary before accepting this removal. Packages that depend on
/usr/bin/perlare removed withperl-interpreter.
sudo dnf remove perl-interpreter
Verify that the package is gone, then clear the current shell’s command cache before checking PATH:
rpm -q perl-interpreter
hash -r
command -v perl || echo "perl not installed"
package perl-interpreter is not installed perl not installed
Remove User-Local CPAN Data
Only use this cleanup step if your CPAN configuration created ~/perl5 and ~/.local/share/.cpan in your home directory.
The following commands permanently delete user-installed CPAN modules, downloaded tarballs, and CPAN build metadata from your home directory. Back up anything you still need first.
rm -rf ~/.local/share/.cpan ~/perl5
If CPAN added environment variables to ~/.bashrc, open the file in your editor, remove the ~/perl5/bin, PERL5LIB, PERL_LOCAL_LIB_ROOT, PERL_MB_OPT, and PERL_MM_OPT lines, then reload the shell profile:
source ~/.bashrc
Verify that the user-local CPAN directories are gone:
test -d ~/.local/share/.cpan || echo "~/.local/share/.cpan removed"
test -d ~/perl5 || echo "~/perl5 removed"
~/.local/share/.cpan removed ~/perl5 removed
Conclusion
Perl is installed from Fedora’s DNF-managed packages, with the full package, standalone interpreter, and CPAN client roles mapped clearly for updates and removal. For nearby development setup, install Git on Fedora before versioning scripts or packaging work.


Formatting tips for your comment
You can use basic HTML to format your comment. Useful tags currently allowed in published comments:
<code>command</code>command<strong>bold</strong><em>italic</em><blockquote>quote</blockquote>