anjultyagi has asked for the wisdom of the Perl Monks concerning the following question:
Hi All, I have some requirement, in which i have to use perl language in postgres DB. I have been facing one issue in creating the Hash. below is my code that is having issue:
while (($key,$value) = each(%{$parts_jsonlb->[$slb]})) { #elog(NOTICE, 'Key '.$key .' Value '.$value); #elog(NOTICE, 'REfernece '. ref($value) ); if (ref($value) eq 'HASH') {%l_pa = (%l_pa, $value);} else { elog(NOTICE, 'Key '.$key .' Value '.$value); my %perm = ($key => $value); elog(NOTICE, 'l_pa '.Dumper(%perm)); %l_pa = (%l_pa,%perm); } }
in the code "my %perm = ($key => $value);" i am not able to generate the HASH value. When I tried to dumper, it does not look like the HASH value. Current code output: NOTICE: l_pa $VAR1 = 'amountSubmitted'; $VAR2 = '0.00'; Expected output: 'amountSubmitted' => '0.00' its really urgent and i am stuck with that code.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Unable to create HASH type
by roboticus (Chancellor) on May 07, 2018 at 11:10 UTC | |
|
Re: Unable to create HASH type
by haukex (Archbishop) on May 07, 2018 at 11:17 UTC | |
|
Re: Unable to create HASH type
by johngg (Canon) on May 07, 2018 at 11:30 UTC |