if ($file =~ //) {
$mapattach = undef;
}
Because the order is random it depend which keys follow as to whether it gets corrected. The fix is to add a line to skip the blanks lines in here
# parse the config file
while (<FILE>) {
# remove leading spaces
$_ =~ s/^\s+//g;
# remove trailing spaces
$_ =~ s/\s+$//g;
# ignore comments
next if $_ =~ /^#/;
# ignore blanks
next unless /\S/;
my @params = split /=/ , $_;
$CONFIG_PARAMS{$params[0]}=$params[1];
}
A better way would be use a regex to extract the key from the filename and match directly like this.
my $mapattach;
# add () inside // to capture match
if ($file !~ /($CONFIG_PARAMS->{'OUTCRIT'})/) {
Println "Skipping $file, doesn't match $CONFIG_PARAMS->{'OUTCRIT'}";
next OUTBOUND;
} else {
$mapattach = $CONFIG_PARAMS->{$1};
}
poj
|