sandeep.waikar has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I am having below hash in my programm.
$moduleRef->{modRef}{$moduleName}{ioRef}{$net}.....When is check for some string of $net1 if its is part of hash and defined or not, It went into that loop even if its wasn't part of the hash.
My code is here.
foreach my $net(@netLst){ if($net =~ /\'/) {next;} elsif(defined ($moduleRef->{modRef}{$moduleName}{ioRef}{$net})) { print "$net is part of hash"; } }
Even though some element of @netLst which wasn't defined for above hash, else loop got executed and it printed
"XYZ is part of hash"... where as actually its not.
Please help me in solving this.
I am using Pel v5.10.1 version.
Thanks,
Sandeep
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Wrong Results in checking if hash value is defined or not
by Eily (Monsignor) on Jun 30, 2017 at 08:26 UTC | |
by sandeep.waikar (Initiate) on Jun 30, 2017 at 09:38 UTC | |
by Eily (Monsignor) on Jun 30, 2017 at 09:51 UTC | |
|
Re: Wrong Results in checking if hash value is defined or not
by Anonymous Monk on Jun 30, 2017 at 08:21 UTC | |
|
Re: Wrong Results in checking if hash value is defined or not
by locked_user sundialsvc4 (Abbot) on Jun 30, 2017 at 14:54 UTC |