My question here is how does perl decide which Config.pm it uses?

I think I solved my own question here. When perl looks for Config.pm it starts at the top of @INC and keeps on going until it finds a match. I conjecture that it's guaranteed that there is one at the ultimate path with perl-base:

$ ./2.cf.pl </usr/lib/x86_64-linux-gnu/perl/5.26> --------------- /home/bob/perl5/lib/perl5/x86_64-linux-gnu-thread-multi /home/bob/perl +5/lib/perl5 /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /us +r/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/s +hare/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 / +usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base path is /usr/lib/x86_64-linux-gnu/perl/5.26/Config.pm stat is File::stat=ARRAY(0x55f122748b70) $VAR1 = bless( [ 2054, 6591373, 33188, 1, 0, 0, 0, 3372, 1539824438, 1531923663, 1532749911, 4096, 8 ], 'File::stat' ); path is /usr/lib/x86_64-linux-gnu/perl-base/Config.pm stat is File::stat=ARRAY(0x55f122ad48c0) $VAR1 = bless( [ 2054, 6591655, 33188, 1, 0, 0, 0, 3373, 1539712704, 1531923663, 1532749916, 4096, 8 ], 'File::stat' ); $ cat 2.cf.pl #!/usr/bin/perl -w use 5.011; use utf8; use Config qw/%Config config_vars/; use Path::Tiny; use Data::Dumper; my $insarchname = $Config{'installarchlib'}; print "<$insarchname>\n"; say "---------------"; say "@INC"; foreach (@INC) { my $path1 = path( $_, "Config.pm" ); if ( -f $path1 ) { my $stat = $path1->stat; say "path is $path1"; say "stat is $stat"; say Dumper $stat; } } $

In reply to Re^3: how to get Config values into a hash by Aldebaran
in thread how to get Config values into a hash by Aldebaran

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.