Data::Dumper is useful for investigating unknown data structures.

Dummy ini file for testing:

$ cat > pm_config_any.ini some_key=qwerty password=Pa55w0rd other_key=zxcvbn

Code to see full $cfg structure and the specific item you want:

$ perl -Mstrict -Mwarnings -E ' use Config::Any; use Data::Dumper; my $pw_ini_file = q{./pm_config_any.ini}; my @files = ($pw_ini_file); my $cfg = Config::Any->load_files({files => \@files, use_ext => 1}); say q{Full $cfg structure:}; say Dumper $cfg; say q{Password: }, $cfg->[0]{$pw_ini_file}{password}; ' Full $cfg structure: $VAR1 = [ { './pm_config_any.ini' => { 'password' => 'Pa55w0rd', 'some_key' => 'qwerty', 'other_key' => 'zxcvbn' } } ]; Password: Pa55w0rd

-- Ken


In reply to Re: Using config::any by kcott
in thread Using config::any by ItsyBitsy

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.