The title might be a little weird but I couldn't sum up better what I want to know.

So I'm working on a macOS. As war as I know /usr/bin/perl is the default perl which comes with the OS. Some people say it's bad and you can't get full usage out of it so they prefer to install perl again via homebrew - The Missing Package Manager for macOS (or Linux).. No matter which perl (default=/usr/bin/perl / or homebrew=/usr/local/bin/perl is "active" for me cpan stays on the same location (/Users/myusername/.cpan). I double checked both with perl -MCPAN -e shell aswell.
How does this work? Does cpan install the Modules into it's own directories and no matter which perl is active, perl is just allowed to access those folders?

On Stackoverflow I found an article about cpan-vs-mcpan-perl saying:
cpan installs for the perl in the shebang (#!) line of the cpan file.
When someone has more than one perl installed on a machine, they sometimes run the wrong copy of cpan, and thus end up installing modules for the wrong instance of perl.
One solution to that would be to specify the full path to the correct cpan file.
perl -MCPAN -e shell is the other solution. It allows you to explicitly specify the install of perl for which you want the modules to be installed.
I'd have assumed I have different locations using perl -MCPAN -e shell.

Let's say I want to split my CPANs having one for the default and one for the homebrew perl. How can I do this?
And does reinstalling a new fresh and clean cpan mean just rm -rf /Users/myusername/.cpan?

I hope I can find some Wisdom here to clear up my minds. Thanks in advice.

In reply to Understanding Perl / Brew Perl and Cpan on macOS by feumw

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.