in reply to How to input variable value from a file?

You may want to look into Config::Auto, Config::GitLike, Config::IniPlus, Config::IniFiles, Config::ApacheFormat, Config::Any, Config::Merge,Config::JSON, Config::Tree, Config::XMLPerl, XML::Simple, XML::Rules, DBD::RAM, DBD::CSV, or any of the other Config or structured data file modules on CPAN.

Tastes vary, but I've listed the above in roughly the order I'd recommend them based on your specific request and the examples you've given. Writing your own configuration parser beyond a simple space or colon delimited list per line type of format is really reinventing a mundane sort of wheel. Save your reinventing for more interesting models of wheel.

  • Comment on Re: How to input variable value from a file?