Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^14: Merge hashes in specific format

by ovedpo15 (Pilgrim)
on Jan 13, 2019 at 00:46 UTC ( [id://1228449]=note: print w/replies, xml ) Need Help??


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

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; } ); } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1228449]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-24 08:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found