Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Converting HoA into AoH

by pg (Canon)
on Oct 31, 2005 at 06:25 UTC ( #504169=note: print w/ replies, xml ) Need Help??


in reply to Converting HoA into AoH

Hopefully you understand what that data structure means. It means that, at the top level, you are creating a hash ref with two pairs of elements, each with a hash ref as a key. My guess is that you are probably looking for:

[ { flinstones => "fred", jetsons => "george" }, { flinstones => "fred", jetsons => "jane" }, { flinstones => "barney", jetsons => "george" }, { flinstones => "barney", jetsons => "jane" }, ];

With your data strcture, try this code:

use Data::Dumper; use strict; use warnings; my $blah = { { flinstones => "fred", jetsons => "george" }, { flinstones => "fred", jetsons => "jane" }, { flinstones => "barney", jetsons => "george" }, { flinstones => "barney", jetsons => "jane" }, }; print Dumper($blah);

Which prints:

$VAR1 = { 'HASH(0x224ef8)' => { 'flinstones' => 'fred', 'jetsons' => 'jane' }, 'HASH(0x1876560)' => { 'flinstones' => 'barney', 'jetsons' => 'jane' } };


Comment on Re: Converting HoA into AoH
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (13)
As of 2014-04-16 16:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (432 votes), past polls