Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Merging Data into one array

by choroba (Cardinal)
on Nov 30, 2015 at 20:25 UTC ( [id://1148956]=note: print w/replies, xml ) Need Help??


in reply to Merging Data into one array

You can transform your data into two hashes, ACC being their keys. Then you can easily iterate over the keys of one hash and merge with the corresponding value from the second hash if the key exists there:
my @transformed = map +{ map { my $k = delete $_->{ACC}; $k => $_; } @$_ }, $data1, $data2; my @merged; for my $key (keys %{ $transformed[0] }) { if (exists $transformed[1]{$key}) { push @merged, { ACC => $key, %{ $transformed[0]{$key} }, %{ $transformed[1]{$key} } }; } } print Dumper \@merged;
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-04-16 18:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found