in reply to how to use the values of the first hash to be the keys for the second hash
Do you mean something like this?
use feature ":5.14"; use warnings FATAL => qw(all); use strict; use Data::Dump qw(dump pp); my %a = qw(key1 val1 key2 val2 key3 val3); my %b = qw(val1 val5 val2 val6 val3 val7 val4 val8); my %c = %{{map {($_, $b{$a{$_}})} keys %a}}; pp(\%c)
Produces:
{ key1 => "val5", key2 => "val6", key3 => "val7" }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to use the values of the first hash to be the keys for the second hash
by lrl1997 (Novice) on Sep 07, 2012 at 15:51 UTC | |
by philiprbrenan (Monk) on Sep 07, 2012 at 16:06 UTC | |
by lrl1997 (Novice) on Sep 07, 2012 at 16:34 UTC |