You see, the hash does not have to homogenous. When you do a lookup, either key the Category names so they're easily distinguishable (all caps, put a * in front) as a string or check to see whether the value of your hash key is a reference. If it is, dereference and lookup again. Or better yet, realize that what you really want is a hash of arrays, where when you provide a name you want one or more email addresses back. Note that you never return "Name One", only 'some1@address'. Try organizing like this:my %email = { Category1 => { "Name One", 'some1@address.com }, Category2 => { "Name Two", 'some2@address.com', "Name Three", 'some3@address.com }, "Name One" => 'some1@address.com' }
my %Email = { 'Category1' => [ q(some1@address.com) ], 'Category2' => [ q(some2@address.com some3@address.com) ], 'Name One' => [ q(some1@address.com) ] };
In reply to Re: Complex Hash
by Anonymous Monk
in thread Complex Hash
by Adam
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |