in reply to multiple hash compare, find, create
I don't know how well this would scale on 14MB sets, but this might be a possible solution using Set::Scalar.
Yes, Eily had the most efficient solution. There's no need to create the 3 sets :-(
use Set::Scalar;
my %hash_4;
my $set_1 = Set::Scalar->new(keys %hash_1);
my $set_2 = Set::Scalar->new(keys %hash_2);
my $set_3 = Set::Scalar->new(keys %hash_3);
my $intersect = $set_1 * $set_2 * $set_3;
for my $key (@$intersect) {
push @{$hash_4{$key}}, $hash_1{$key}, $hash_2{$key}, $hash_3{$key}
+;
}
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: multiple hash compare, find, create
by supertaco (Novice) on Dec 10, 2018 at 19:38 UTC | |
Re^2: multiple hash compare, find, create
by supertaco (Novice) on Dec 11, 2018 at 13:26 UTC |
In Section
Seekers of Perl Wisdom