Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
My problem is how to compare all inner keys of each p (%hash2) with all inner key of all logt (%hash1). This is what I have so far...I am stuck!my %hash1 = ( 'A' => { 'log1' => [ '1', '0.0163934' ], log2' => ['1','0.0163934'], 'log3' => ['1','0.0163934' ], } 'B' => { 'log1' => [ '1', '0.0134521' ], 'log3' => ['2','0.0244508'], } ); my %hash2 = ( 'p0001' => { 'log1' => '1', 'log2' => '3', 'log5' => '1', 'log8' => '1',... } 'p0002' => { 'log1' => '1', 'log3' => '2',... } p0004 => ..., p0056 => ..., );
Please I need some guidance$hash1{$logt}{$keylogs}[1]; $hash2{$p}{$pkeylogs}; $hash3{$p} {$logt} =>$totalscore; foreach my $keylogt (keys(%hash1)){ foreach my $keyp (keys(%hash2)){ foreach my $keypinner (keys %{$hash2{$keyp}}){ foreach my $keylogtinner (keys %{$hash1{$keylogt}}){ until($keypinner eq $keylogtinner){ ... $totalscore+=$hash1{$keylogt}{$keylogtinner}[1]; } else{ $totalscore+=$delta; } } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to compare inner keys from two Hashes
by matija (Priest) on Mar 30, 2004 at 09:12 UTC | |
by Anonymous Monk on Mar 30, 2004 at 17:59 UTC | |
|
Re: How to compare inner keys from two Hashes
by Roy Johnson (Monsignor) on Mar 30, 2004 at 19:54 UTC |