open(CONFIG, "$cfgfile") or die "Can't open configuration file: $!"; while () { if (/^#/ or /^\n$/) { next; } else { chomp; s/\s//g; (my $n, my $v) = split(/=/); $CFG{$n} = $v; } } close(CONFIG);