One way I have done config files is to setup the config file as a do'able variable in itself that is a reference to a hash.. You can also use Data::Dumper to create the file. config.txt file as such:
$config = \{ 'Variable1' => 'variable value', 'Variable2' => ['a','b','c'], };
Then you can:
do "config.txt" or die "$! $@";
This creates a variable $config that is a reference to a hash containing all your configuration variables. If your passing the configuration to subroutines you can just pass $config and your subroutine has access to all the config variables and you saved some overhead.

Granted you have to dereference the hash, but references are a good thing to learn..

if (exists $config->{Variable1}) {}

In reply to Re: Re: Check to see if a variable exists by jpream
in thread Check to see if a variable exists by Anonymous Monk

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.