in reply to Re^3: Merge hashes in specific format
in thread Merge hashes in specific format
But it will fail because at start $final_href->{data} is not defined. How to make it work even if its not defined (in that case I should just get the $data{$data}foreach my $dir (@{$dirs}) { decode($dir.".data.json",%data); # will change name my $final_href = { data => { ( %{$final_href->{data} },%{ $data{data} } ) }, total => do { my %total; for my $href ( $final_href->{total}, $data{total} ) { $total{$_} += $href->{total}{$_} for keys %{ $href +->{total} }; } \%total; } };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Merge hashes in specific format
by LanX (Saint) on Jan 12, 2019 at 22:59 UTC | |
by ovedpo15 (Pilgrim) on Jan 12, 2019 at 23:05 UTC | |
by LanX (Saint) on Jan 12, 2019 at 23:17 UTC | |
by ovedpo15 (Pilgrim) on Jan 12, 2019 at 23:25 UTC | |
by LanX (Saint) on Jan 12, 2019 at 23:27 UTC | |
|