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

%{ $files_href->{data} // {} }

Replies are listed 'Best First'.
Re^16: Merge hashes in specific format
by ovedpo15 (Pilgrim) on Jan 13, 2019 at 01:46 UTC
    Thank you. I didn't know there is a special operator like this one. Another small question if you may. Is it possible to insert the data into two hash at the same line? something like:
    (%{$one},%{two}) = ( data => { ( %{ $data{data} }, %{ $one->{data} // {} } ) }, total => do { my %total; for my $href ( $one->{total}, $data{total} ) { $total{$_} += $href->{$_} for keys %{ $href }; } \%total; } );