OK, took some finding but this might be the problem. The blank lines in your config file are creating a blank key entry in the %CONFIG_PARAMS hash i.e. "" => undef. When you loop through the keys at some point the match becomes

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

In reply to Re^4: Code Issue after Upgrading the perl from 5.14.4 to 5.22.3 by poj
in thread Code Issue after Upgrading the perl from 5.14.4 to 5.22.3 by Srinath

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.