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:

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";
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.

Hhalpiin

P.S. - If perlmonks doesn't automatically do this, please e-mail me your response. Thanks! It will never print "hey you"


In reply to How to use a list of structs that contain a list of structs? by hhalpin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.