in reply to Re^12: Merge hashes in specific format
in thread Merge hashes in specific format

That's not a sub.

Posting incomplete code will cause an incomplete an

Replies are listed 'Best First'.
Re^14: Merge hashes in specific format
by ovedpo15 (Pilgrim) on Jan 13, 2019 at 00:46 UTC
    I'm sorry. here you go:
    my %final_href; merge_jsons(".data.json",\@dirs,\%final_href); sub merge_jsons { my ($name,$dirs,$final_href) = @_; my %data; foreach my $dir (@{$dirs}) { decode($dir."/".$name,%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->{to +tal} }; } \%total; } ); } }
Re^14: Merge hashes in specific format
by LanX (Saint) on Jan 13, 2019 at 00:48 UTC
    > Posting incomplete code will cause an incomplete an

    brilliant! xD

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice