if ($file =~ //) { $mapattach = undef; } #### # parse the config file while () { # 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]; } #### 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}; }