in reply to array in hash in hash access
It is one correct way to write the datastructure. One of the easiest ways of displaying an entire datastructure is to use Data::Dumper. With the data structure you posted, you would use Data::Dumper like this:
use strict; use warnings; use Data::Dumper; my %t_type = ( 'a' => { 'chance' => {'low' => 2, 'high' => 12, 'percent' => 50}, 'range' => {'number' => '','disallowed' => ['none','1','2']}, } ); print Dumper \%t_type;
The datastructure you've written is a hash of hashes of hashes, where one of the innermost hash's elements references an array.
What exactly are you trying to do, iterate over the entire structure? Take a slice of a portion of it? What do you need? One place to look for some answers is perldsc: The Perl Datastructure Cookbook; included in the POD of every complete Perl distribution.
You can dereference the deepest level array in scalar context to get its size.
Dave
|
|---|