Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 avoiding work at the Monastery: (4)
As of 2014-09-22 06:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (182 votes), past polls