some_key_param=value #### my $config = read_config({ filename => 'some_config_file' }); # {{{ read_config # sub read_config { my $args = shift; die "No configuration file specified\n" unless defined $args->{filename}; open my $conf_fh, '<', $args->{filename} or die "Error opening conf file...$!\n\n"; my $conf = {}; for (<$conf_fh>) { chomp; # use '=' as the separator if ( $_ =~ m/[=]/ ) { # skip these lines s/#.*//; s/^\s+//; s/\s+$//; next unless length $_; my ( $key, $value ) = split( /\s*=\s*/, $_, 2 ); $config->{$key} = $value; } } close $conf_fh; return $conf; } # }}}