in reply to Converting HoA into AoH
Ths assumes that each array has an even number of elements.
my $HoH = { map{ $_ => { @{ $HoA->{$_} } } } keys %{ $HoA } };
Update: I completely misread that. Here's the correct version.
my $HoH = { map{ $_ => { map{ $_ => } @{ $HoA->{$_} } } } keys %{ $Ho +A } };
Update2: And still it was wrong. I think you have your answer now, so I'll shut up.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Converting HoA into HoH
by neversaint (Deacon) on Oct 31, 2005 at 06:26 UTC |