Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Hash of Array of Hashes

by nvivek (Vicar)
on Apr 28, 2011 at 05:06 UTC ( #901709=note: print w/ replies, xml ) Need Help??


in reply to Hash of Array of Hashes

You explain with an example data. Now I tried with an example hash according to your description. If I understood your hash structure wrongly, you give the example data.

use strict; use warnings; use Data::Dumper; my %hash=("logins" => [ { '1' => 'http://www.perlmonks.com/?node_id=90 +1658' , '2' => 'http://www.google.com' }, { '3'=> 'http://www.bksyste +ms.co.in'}]); #prints the structure of the hash print Dumper \%hash; print "==========================\n"; # getting the length of an array and going through each index of an ar +ray for (0 .. length @{$hash{'logins'}}) { for my $key (keys%{$hash{'logins'}[$_]}) { # printing key and value print "Key: $key and Value:$hash{'logins'}[$_]{$key}\n"; + } print "==========================\n" }


Comment on Re: Hash of Array of Hashes
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (12)
As of 2015-07-29 02:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls