First, I want to thank you all for welcoming me!

I didn't expect to get an answer so quickly when I noticed Loops posted the first answer. I did some experiments with the code Loops corrected for me, mainly trying to replace the constants in the example with variables, as the final content of the struct members are not yet known when the struct is created. But I then ran into new problems trying this... Then I noticed two more replies arrived.

I think perlron's suggestion to thoroughly read perlreftut, perldata, perldsc and perlvar docs could indeed be the key. By the way, I read the class::struct doc several times, but it leaves open a lot of questions. Maybe the docs mentioned will reveal much insight... At least it could help avoiding things like misunderstanding of strings being arrays Athanasius pointed at...

I'll also look into Moo instead of class::struct, as suggested by Loops and Athanasius.

Thank you again! Now I'll have to read a lot more documentation and do more experimenting...


In reply to Re^2: How to allocate a struct? by dissident
in thread How to allocate a struct? by dissident

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.