I want to print contents of a hash which itself is inside another hash.
This is how the code looks like-
Once %Queues is populated with %Hashes vals, how do I print/access elements of %Hashes inside %Queues.my %Queues; $sql = "a valid sql statement"; $sth = $dbh->prepare($sql); $sth->execute(); while (my @Row = $sth->fetchrow_array()) { my %Hashes; $Hashes{QueueID} = 0; $Hashes{Queue} = $CustomQueue; $Hashes{MaxAge} = 0; $Hashes{Count} = $Row[0]; #print "Record Count = $Row[0] \n"; push (@{$Queues{Queues}}, \%Hashes); # set some things if ($QueueId == 0) { $Queues{TicketsShown} = $Row[0]; $Queues{TicketsAvail} = $Row[0]; } }
When I do following I get error-
Any help will be greatly appreciated.while (my ($key,$value) = each(%Data)){ #print "$key = $value \n"; for(my ($k,$v) = each($key->{'Queues'})){ print "$k = $v \n"; } }
Thanks
In reply to Accessing hash elements inside another hash by bar10der
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |