Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Converting HoA into AoH

by tphyahoo (Vicar)
on Oct 31, 2005 at 13:40 UTC ( #504256=note: print w/replies, xml ) Need Help??


in reply to Converting HoA into AoH

Not sure if this repeats what's already been said, but in case this helps:

UPDATE: Except I didn't do the cartesian product... but anyways...

use strict; use warnings; use Data::Dumper; my $AoH_show_characters = []; my $HoA_show_characters = { flintstones => [ "fred", "barney" ], jetsons => [ "george", "jane"], }; foreach my $show (keys %$HoA_show_characters) { foreach my $character ( @{ $HoA_show_characters->{$show} } ) { push @$AoH_show_characters, ( { $show => $character } ); } } print Dumper($AoH_show_characters);

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://504256]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2020-05-31 04:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (173 votes). Check out past polls.

    Notices?