Well, TMTOWTDI in Perl, but I do this just after my use ... declarations:
Code:
# Declare cfg pkg so we can refer to it anywhere
{
package cfg;
# Config file params
%cfg::params = ();
# Database interaction
$cfg::dbh = '';
}
and then later access as
Code:
if( $cfg::params{'DEBUG'} >= 1 )
{
print "load_ctrl()\n";
}
or
Code:
$sql = "blah";
$sth = $cfg::dbh->prepare($sql);
Basically means that var is global across Perl file and always prefixed with pkg name.