Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Code Issue after Upgrading the perl from 5.14.4 to 5.22.3

by madtoperl (Hermit)
on Feb 10, 2017 at 13:47 UTC ( [id://1181658]=note: print w/replies, xml ) Need Help??


in reply to Code Issue after Upgrading the perl from 5.14.4 to 5.22.3

Hi,
please use below in your code first
use strict; use warnings;
Also it looks like $mapattach variable is not declared with the right scope and causing the issue or data in the input file gets change for different runs.

Replies are listed 'Best First'.
Re^2: Code Issue after Upgrading the perl from 5.14.4 to 5.22.3
by stevieb (Canon) on Feb 10, 2017 at 15:36 UTC

    It is in the correct scope the way it is being used (global in this case), it's just difficult to tell because of poor code formatting. It should all be left-justified, with the exception of the statements within the while and unless statements, which should be indented only once.

    Perl::Tidy can help those who are unfamiliar with proper indentation get a good grasp of it.

    my %CONFIG_PARAMS; my $mapattach; while (my ($key , $value) = each(%CONFIG_PARAMS)) { if ($file =~ /$key/) { $mapattach = $value; } } unless (defined $mapattach) { Println "WARN : Ignoring $file, not found in the config file"; }

    What I see is that %CONFIG_PARAMS has been declared, but not defined, so it'll always be empty. However, perhaps this isn't the real code OP is really using, which makes troubleshooting the issue pretty much impossible.

Re^2: Code Issue after Upgrading the perl from 5.14.4 to 5.22.3
by Anonymous Monk on Feb 10, 2017 at 15:21 UTC
    Also it looks like $mapattach variable is not declared with the right scope

    Which scope instead?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1181658]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-19 02:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found