------------------------------------------------------------------------------- Key-Value configuration files ------------------------------------------------------------------------------- This is the simplest style of configuration file, but also the least useful for more complex data types. There are many different styles, and formats with little uniformity. As such every application is unique, with its own rules and problems. Most of the other configuration file formats started out as simple key-value formats and slowly grew more complex to handle text, arrays, hashes, and hierarchic data. For example just the delimiter between the key-value pairs could be '=', ':', or spaces. Sourced configuration files... In the simplest case, the file may be just a file of variable assignments in the language of the application. This can be just directly sourced by the application. For example: bash, perl, python, makefile, etc... However that means that you much completely trust the source of the configuration file or hackers can use it to gain more access. As such while appropriate in some cases, it is not advisable in the long term. ------------------------------------------------------------------------------- Perl Reading... Looped... NOTE: the use of 'non-greedy' RE matching open($config, "config.rc") || die; while(<$config>){ my ($key, $val) = $_ =~ /(.*?)=(.*)/; $config{$key} = $val; } close($config) Read all in one go... open(F,"config.txt"); %config = map { split(/=|\s+/, $_, 2); } ; close(F); -------------------------------------------------------------------------------