use strict; use Class::Struct; struct child_t => { type => '$', }; struct parent_t => { type => '$', child => 'child_t', children=>'@', }; #--- For a single child ---- my $Dad = new parent_t(child=> new child_t(type=>"teenager")); print $Dad->child->type() . "\n"; #------ To use Multiple Children --- my $index=0; for (2..6){ $Dad->children($index++, new child_t(type=>"Type $_")); } for (@{ $Dad->children() }){ print "Kid type " . $_->type() . "\n"; }