Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have tried to setup cpan on my ubuntu 12.04 using:

sudo cpan

and it created a folder perl5 in my $HOME folder. I would like to use a different directory such as $HOME/.perl5 or somewhere in /usr/local/lib for the modules. Is it possible?

share|improve this question
up vote 5 down vote accepted

The destination to which CPAN installs modules can be changed by setting its options (run o conf in the CPAN shell):

makepl_arg         [INSTALL_BASE=/home/gokcehan/.perl5]
mbuildpl_arg       [--install_base=/home/gokcehan/.perl5]

To let CPAN and Perl search for modules in the given path, set the environment variable PERL5LIB:


where $arch is the output of

use Config;
print Config->{archname};
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.