knoppix@Microknoppix:~$ perl -MData::Dumper -Mstrict -wE '
> my %rep = ( one => 123, two => 456 );
> my %comb = ( one => 987, two => 654 );
> my %new = map { $_, [ $rep{ $_ }, $comb{ $_ } ] } keys %rep;
> print Data::Dumper->Dumpxs(
> [ \ %rep, \ %comb, \ %new ],
> [ qw{ *rep *comb *new } ]
> );
> say q{-} x 30;
> push @{ $new{ two } }, 888;
> $new{ three } = { four => 444, five => 555 };
> print Data::Dumper->Dumpxs( [ \ %new ], [ qw{ *new } ] );'
%rep = (
'one' => 123,
'two' => 456
);
%comb = (
'one' => 987,
'two' => 654
);
%new = (
'one' => [
123,
987
],
'two' => [
456,
654
]
);
------------------------------
%new = (
'three' => {
'five' => 555,
'four' => 444
},
'one' => [
123,
987
],
'two' => [
456,
654,
888
]
);
knoppix@Microknoppix:~$
I hope this is helpful.
|