Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Always bear in mind that Perl is a pragmatic language, built “out of necessity”   Lots of people (from “Larry Wall, himself” on forward) have faced the same problems that you did, and developed a pragmatic way to solve them.

In (this | your | their) case, the “magic pixie dust” is called references.   The apparent “complexity” of your situation in-fact arises from the fact that you need to insert “a complex data-structure” into one and only one place.   This requirement is very elegantly (and very completely ...) handled by the singular notion of “a reference,” which is:   “a single thing” (i.e. it can exist “in one place”) that can refer to (ommmm.....) anything-at-all.   (Furthermore, you can have any number of references to the selfsame thing ... so it can be in more than one place at the same time, if you so desire.)

The next key to this puzzle is ... that you can express this key notion without a bunch of extra steps.   In other words, without declaring a bunch of extra, otherwise-unnecessary variables.   Instead of “first” declaring @whatever and then later referring to \@whatever, you can simply describe what you really want, in one pragmatic step, and Perl will understand.

The Perl language is, after all, a human tool, that was originally conceived by someone who “had a job to ‘get done’,” and who devised the most-straightforward (to him... at the time ...) way, by which he could persuade a digital computer(!!) to do it.   (And hundreds if not thousands of other kindred souls, faced in their turn with the selfsame objective, have surely labored upon it since.)

Fact is... “Representing a complex data structure” is par for the course to every single one of us, from Larry Wall on down.   We’ve gotten very good at it.   ;-)

In reply to Re: How to better represent a complex data structure. by sundialsvc4
in thread How to better represent a complex data structure. by Amblikai

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others chilling in the Monastery: (6)
    As of 2017-06-26 07:42 GMT
    Find Nodes?
      Voting Booth?
      How many monitors do you use while coding?

      Results (573 votes). Check out past polls.