Better yet: use Config::File, Config::General, Config::IniFile, Config::Tiny or Config::Any.
IMHO it's never a good idea to roll your own config file parsing, when you have many CPAN modules to do the heavy lifting for you.
With Config::Any you can even use XML config files if necessary.