Macports provides hundreds of Open Source Unix tools compiled for OS X, free.
Macports is an alternative to Fink. Some packages are available in only one package manager and some in both. You can use either or use both and install some packages with one tool and some with the other.
If you are upgrading from a previous version, see https://trac.macports.org/wiki/Migration.
Mavericks and Yosemite come with Perl 5.16. El Capitan comes with Perl 5.18.2.
On recent versions of OS X, installing certain ports will cause Macports to install a later version of Perl (on El Capitan, it installed 5.22).
If you then update CPAN, it will install Perl modules into that version's libraries.
The version of Perl executed by programs will depend on the shebang line at the top of the file, and that is where library files will be searched for.
The result is that modules you just installed will not be found, and attempts to install ports will fail with messages about variants.
Adjust the $PERL5LIB shell environment variable so that the latest Perl libraries are searched.
For Yosemite, I used PERL5LIB=/Users/myname/bin:/opt/local/lib/perl5/site_perl/5.16.3
For El Capitan, I used PERL5LIB=/Users/myname/bin:/opt/local/lib/perl5/site_perl/5.22 and symlinked /usr/bin/perl to /opt/local/bin/perl to ensure that the correct version is invoked (had to temporarily disable SIP). I also did
export PERL5LIB=/Users/thvv/bin:/opt/local/lib/perl5/5.22 export PERL_LOCAL_LIB_ROOT="/opt/local/lib/perl5/5.22" export PERL_MB_OPT="--install_base "/opt/local/lib/perl5/5.22"" export PERL_MM_OPT="INSTALL_BASE=/opt/local/lib/perl5/5.22"