in reply to How to read hash of .cfg file

do 'my_config.cfg' or die $!;
is the canonical way to do this, BUT:
  1. The config file must be valid Perl (and yours isn't)
  2. You cannot use lexical variables as their scope will end at the end of the config file.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James