Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Print elements of hash references

by Anonymous Monk
on Mar 31, 2012 at 18:21 UTC ( #962786=note: print w/ replies, xml ) Need Help??


in reply to Re: Print elements of hash references
in thread Print elements of hash references

Thanks for that I will have a look. Can you tell me how to do it with this particular example? Those are (I think) array references and not array of arays or hash or arrays etc that the perldsc have.


Comment on Re^2: Print elements of hash references
Re^3: Print elements of hash references
by chromatic (Archbishop) on Mar 31, 2012 at 18:33 UTC

    Looks like you have a hash of hashes of arrays of arrays. The principle is the same no matter how far you nest.

Re^3: Print elements of hash references
by RichardK (Priest) on Mar 31, 2012 at 18:33 UTC

    where did $An get declared?

    Well, I don't really understand the code fragment you posted but, maybe

     print $An->{id}[0];

    Try using Data::Dumper to see the contents of $An

Re^3: Print elements of hash references
by Happy-the-monk (Monsignor) on Mar 31, 2012 at 18:37 UTC

    push @{$An{$n}->{b}} , $bb[$idx];

    let's see, if perldsc did not make it clear enough, maybe perldata and perllol will help a bit further?
    Anyway, looking for "references" and Hashes of Hashes (HoH) and Hashes of Arrays (HoA) in the documentation and also on this site may help you along.

    What you are doing is pushing onto an array reference that is inside a hash (%An) of hashes the value in position ($idx) of an array (@bb).

    I am a little curious though: If you don't know what you are doing, why are you doing it?

    To see the results, do try use Data::Dumper;print Dumper \%An;

    Cheers, Sören

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2014-08-01 10:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (4 votes), past polls