in reply to Re^2: Nested Class::Struct
in thread Nested Class::Struct
This is closer to the syntax you were attempting (also works):push @{ $Dad->children }, new child_t(type=>"Flower Child");
However, as others have pointed out, Class::Struct is a stepping stone into OO perl programming.push @{ $Dad->children }, child_t::new('child_t','type',"Wild Child") +;
I'm still learning (after using perl for 8 years), and heading towards Moose (Which is sort of built-in to perl6).
Update: The second example above is unnatural - here is a better way:
push @{ $Dad->children }, child_t->new(type=>"Natural Child");
Syntactic sugar causes cancer of the semicolon. --Alan Perlis
|
|---|