in reply to Complex Hash

OK, Maybe it's the DB admin in me but why not this:

my %Emails = ( 'Name 1' => 'Some1@somewhere.com', 'Name 2' => 'Some2@whereelse.com', 'Name 3' => 'Some3@nowhere.com', 'Name 4' => 'Some4@someelse.com', 'Category1' => [ 'Name 1', 'Name 2' ], 'Category2' => [ 'Name 2', 'Name 3', 'Name 4'], ); sub GetEMailFor { my %names = (); foreach my $request ( @_ ) { if (ref ($Emails{$request}) eq 'ARRAY') { foreach my $em (@{$Emails{$request}}) { $names{$em}=1; } } else { $names{$request}=1; } } return join ',', map($Emails{$_}, keys %names); } print (GetEMailFor('Name 1', "Category2") ."\n");

Actually tested... and I leave the recursion that would allow categories to contain other category references as an exercise for the reader.

--
$you = new YOU;
honk() if $you->love(perl)