Fedora 43 ships Perl 5.42.0 in its repositories, but the full Perl toolchain is not guaranteed to be installed on every Fedora system out of the box. To install Perl on Fedora, the recommended perl metapackage gives you the interpreter, core modules, cpan, perldoc, and development files in one DNF install.
If you only need /usr/bin/perl to run existing scripts, Fedora also offers the smaller perl-interpreter package. The walkthrough below covers both package choices, installing extra modules from Fedora repositories, a quick Hello World test, common errors such as Can't locate DateTime.pm in @INC, and clean removal.
Install Perl on Fedora
Choose the full perl package for development work, CPAN access, and bundled documentation. Use perl-interpreter only when you need the standalone runtime for existing scripts and want the smallest install footprint.
| Package | What It Installs | Command | Best For |
|---|---|---|---|
perl | Interpreter, core modules, cpan, perldoc, and perl-devel | sudo dnf install perl | Development work, module management, and full Perl environments |
perl-interpreter | Standalone /usr/bin/perl runtime | sudo dnf install perl-interpreter | Running existing scripts with a smaller dependency set |
The full perl metapackage is the better default for most Fedora systems. Fedora does not use a separate perl-core base package for this workflow, so install perl for the full toolchain or perl-interpreter for the smaller runtime.
Refresh Fedora Before Installing Perl
Start with a refresh so DNF reads the latest Fedora 43 package metadata before installing Perl.
sudo dnf upgrade --refresh
This guide uses
sudofor commands 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
This installs the Fedora metapackage that pulls in the interpreter, core modules, CPAN client, documentation, and development headers.
sudo dnf install perl
Verify that Perl works and that the cpan client is available:
perl -v | sed -n '1,2p'
which cpan
This is perl 5, version 42, subversion 0 (v5.42.0) built for x86_64-linux-thread-multi (with 24 registered patches, see perl -V for more detail) /usr/bin/cpan
On the Fedora 43 test VM, sudo dnf install perl also installed perl-doc and perl-devel, so the full package is enough for most readers without extra add-ons.
Install Only the Standalone Perl Interpreter
Use this smaller package when you only need /usr/bin/perl to run scripts and do not need CPAN, bundled docs, or the full core-module set.
sudo dnf install perl-interpreter
Check that the interpreter works and confirm that cpan is still absent:
perl -v | sed -n '1,2p'
command -v cpan || echo "cpan not installed"
This is perl 5, version 42, subversion 0 (v5.42.0) built for x86_64-linux-thread-multi (with 24 registered patches, see perl -V for more detail) cpan not installed
Install Perl Modules on Fedora
Fedora packages many Perl modules as RPMs, and DNF can resolve them by Perl namespace. That is the cleanest way to add modules 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.
dnf repoquery --whatprovides 'perl(DateTime)'
dnf repoquery --whatprovides 'perl(DBD::mysql)'
perl-DateTime-2:1.66-4.fc43.x86_64 perl-DBD-MySQL-0:5.013-1.fc43.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. The full
perlmetapackage also installs/usr/bin/cpan, but DNF-managed modules are easier to update and remove cleanly on Fedora.
If Fedora does not package the module you need, the full perl package still gives you cpan. On Fedora 43, a non-root CPAN session bootstrapped a user-local library under ~/perl5 and stored its working data in ~/.local/share/.cpan instead of writing into system Perl directories.
Run a Quick Perl Test on Fedora
A one-line script is enough to confirm 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 updates or after switching from the full perl package to 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, install it, and verify that Perl can load it:
dnf repoquery --whatprovides 'perl(DateTime)'
sudo dnf install 'perl(DateTime)'
perl -MDateTime -e 'print DateTime->VERSION, qq(\n)'
perl-DateTime-2:1.66-4.fc43.x86_64 1.66
Fix “cpan: command not found”
This usually happens when you installed only perl-interpreter. The minimal package provides /usr/bin/perl, but it does not install the CPAN client.
bash: cpan: command not found
Install the full perl metapackage, then verify that cpan is present:
sudo dnf install perl
which cpan
/usr/bin/cpan
Remove Perl from Fedora
Remove the Full Perl Toolchain
If you installed the full perl metapackage, remove it first with DNF.
sudo dnf remove perl
Verify that the metapackage is gone:
rpm -q perl
package perl is not installed
If command -v perl still returns /usr/bin/perl, another package still depends on perl-interpreter. On the Fedora 43 test VM, git kept the standalone interpreter installed after the full metapackage was removed.
Remove the Standalone Perl Interpreter
Read the DNF transaction summary before accepting this removal. Packages that depend on
/usr/bin/perl, such asgiton the Fedora 43 test VM, are removed withperl-interpreter.
sudo dnf remove perl-interpreter
Confirm that the interpreter is no longer available:
command -v perl || echo "perl not installed"
perl not installed
Remove User-Local CPAN Data
Only use this cleanup step if you bootstrapped a user-local CPAN environment that created ~/perl5 and ~/.local/share/.cpan.
The following commands permanently delete user-installed CPAN modules, downloaded tarballs, and CPAN build metadata from your home directory.
rm -rf ~/.local/share/.cpan ~/perl5
If CPAN added environment variables to ~/.bashrc, open the file in your preferred 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
Frequently Asked Questions
Not for the base Perl install covered here. On Fedora 43, use sudo dnf install perl for the full toolchain or sudo dnf install perl-interpreter for the smaller runtime. If you need an extra module, query it by namespace with dnf repoquery --whatprovides 'perl(Module::Name)'.
perl is the full metapackage and installs the interpreter, core modules, cpan, perldoc, and development files. perl-interpreter installs only the standalone /usr/bin/perl runtime, which is enough for existing scripts but not for CPAN-based module work.
Yes. On Fedora 43, sudo dnf install perl also installed /usr/bin/cpan, perl-doc, and perl-devel on the test VM. If you install only perl-interpreter, the cpan command is not available.
Removing the perl metapackage only removes that package. If another installed package still requires perl-interpreter, DNF keeps /usr/bin/perl in place. On the Fedora 43 test VM, git kept perl-interpreter installed until it was removed too.
Conclusion
Perl is ready on Fedora, whether you need the full CPAN-capable toolchain or just the standalone interpreter for existing scripts. If you are building or versioning projects next, install Git on Fedora, then add install Go on Fedora or install Rust on Fedora for other CLI-heavy development work.
Formatting tips for your comment
You can use basic HTML to format your comment. Useful tags currently allowed:
<code>command</code>command<strong>bold</strong><em>italic</em><blockquote>quote</blockquote>