Skip to content

Instantly share code, notes, and snippets.

@glwinsor
Last active May 19, 2018 00:22
Show Gist options
  • Save glwinsor/3f696de1671bb421839f3348adaf800d to your computer and use it in GitHub Desktop.
Save glwinsor/3f696de1671bb421839f3348adaf800d to your computer and use it in GitHub Desktop.
[config file] Read simple config file (key=value pairs) and assign to hash
// vim: syntax=perl
my %CONF;
open my $configfile, '<', 'config.txt' or die $!;
while (<$configfile>) {
chomp;
my ( $key, @value ) = split( "=", $_ );
$CONF{$key} = join '=', @value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment