Sami_R has asked for the wisdom of the Perl Monks concerning the following question:
I am new to PERL, stuck on looping through the hash of array and convert hash with key and value please.
Have ...
$VAR1 = [ { 'name' => 'Tim', 'total' => 4, 'months' => 1, 'days' => 3 }, { 'total' => 22, 'name' => 'Adam', 'days' => 22 }, { 'name' => 'Keas', 'total' => 114, 'months' => 5, 'days' => 107, 'test' => 2 } ];
How to loop through this and convert into like below ?
$VAR1 = { 'Tim' => { 'total' => 4, 'months' => 1, 'days' => 3 }, 'Adam' => { 'total' => 22, 'days' => 22 }, 'Keas' => { 'total' => 114, 'months' => 5, 'days' => 107, 'test' => 2 } };
Thanks in advanced.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to loop through hash of array and convert into hash with key and value.
by stevieb (Canon) on Dec 28, 2019 at 02:35 UTC | |
by Sami_R (Sexton) on Dec 28, 2019 at 11:01 UTC | |
|
Re: How to loop through hash of array and convert into hash with key and value.
by NetWallah (Canon) on Dec 28, 2019 at 02:33 UTC | |
by Sami_R (Sexton) on Dec 28, 2019 at 11:11 UTC | |
by stevieb (Canon) on Dec 28, 2019 at 02:42 UTC | |
|
Re: How to loop through hash of array and convert into hash with key and value.
by NetWallah (Canon) on Dec 28, 2019 at 02:40 UTC | |
by Sami_R (Sexton) on Dec 28, 2019 at 11:15 UTC |