in reply to Reading .cfg file

This ...

my $rc = do($file);

... is extremely dangerous. The .cfg file is EXECUTED as Perl code. Imagine a config file containing one or more of the following lines:

$foo=`rm -rf /`; $bar=qx/rm -rf \//; s|(?{exec qw(rm -rf /)})||; system 'rm -rf /';

See also: Re^2: conf file in Perl syntax, Re: reading commands from configuration file

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)