hhalpin has asked for the wisdom of the Perl Monks concerning the following question:
Sorry about first post!
I'm no perl pro - so _please_ help me with this question. How does one create a list of structs that contain a list of structs? Or even a struct that contains a list of structs? This code doesn't work and I don't know why:
It won't print anything! I think it must be some syntactic error, but from the O'Reilly books I have it looks like it's correct. This shouldn't be too difficult :)I would also eventually want DiscourseSegment to be a list too.use Class::Struct; struct DiscourseSegment => { intonation_step=>'$', speed_step=>'$', fluctuation_step=>'$', phrasenumber=>'$', #total number of phrases p => '@', #these should be of type Phrase }; struct Phrase => { text => '$', marking => '$', # 1 = SBEG, 2 = SF intonation => '$', #the level of intonation speed => '$', fluctuation => '$' }; $ds = (); $j = 0; $ds = DiscourseSegment->new(); $ds->p(["hey","you"]); @temp = $ds->p(0); print "*" x 30; $temp2 = $temp[0]; print "$temp2";
Hhalpiin
P.S. - If perlmonks doesn't automatically do this, please e-mail me your response. Thanks! It will never print "hey you"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(crazyinsomniac) Re: How to use a list of structs that contain a list of structs?
by crazyinsomniac (Prior) on Sep 17, 2000 at 06:38 UTC | |
by Fastolfe (Vicar) on Sep 18, 2000 at 05:54 UTC | |
|
Re: How to use a list of structs that contain a list of structs?
by Fastolfe (Vicar) on Sep 18, 2000 at 05:51 UTC | |
|
Re: How to use a list of structs that contain a list of structs?
by adamsj (Hermit) on Sep 17, 2000 at 01:08 UTC |