Can't locate perl module

I am trying to run a perl script on a machine using CentOS Linux 7. I have perl 5.36.1. The script uses a program called polymake which has its own copy of perl. I cannot modify that copy of perl. I can install modules for my copy of perl using cpan.

Using cpan, I have installed the module Algorithm::Combinatorics

$ cpanm Algorithm::Combinatorics
Algorithm::Combinatorics is up to date. (0.27)

In "~/perl5/lib/perl5/Algorithm," there is a file called ""

When I run the following code


use lib '~/perl5/lib/perl5/Algorithm';
use lib '~/perl5/lib/perl5/';

use Combinatorics;

I get the error message

Can't locate in @INC (you may need to install the Combinatorics module)
(@INC contains:  ~/perl5/lib/perl5/ ~/perl5/lib/perl5/Algorithm Polymake::Core::Application=ARRAY(0x3b5c670) /share/software/user/open/polymake/4.10/share/polymake/perllib [...])

When I do the same thing with the module List::Compare, I have no problem.


Here is a more minimal example: I made a file called


use strict;
use warnings;
use Algorithm::Combinatorics "subsets";


Then perl gives the error:

Can't locate loadable object for module Algorithm::Combinatorics in @INC 
(@INC contains: /share/software/user/open/polymake/4.10/share/perl5/lib/perl5/x86_64-linux-thread-multi 
/share/software/user/open/polymake/4.10/share/perl5/lib/perl5 /home/users/mwlarson/perl5/lib/perl5/x86_64-linux-thread-multi /home/users/mwlarson/perl5/lib/perl5 
/share/software/user/open/perl/5.36.1/lib/5.36.1/x86_64-linux-thread-multi /share/software/user/open/perl/5.36.1/lib/5.36.1) at line 6.

Doing the same thing with List::Compare results in no error.


  • There's no directory named ~ in the CWD. The directive should be

    use lib "$ENV{HOME}/perl5/lib/perl5";

    However, it doesn't make much sense to specify where to look in the script since this is a directory usable by any script (i.e. absolute path). Instead, I'd set env var PERL5LIB.

    export PERL5LIB="$HOME/perl5/lib/perl5"

    The second error is due to an incomplete or incompatible version of the module installed in /share/software/user/open/polymake/4.10/share/perl5/lib/perl5. This should not be in PERL5LIB, or it should be after $HOME/perl5/lib/perl5.