Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Comment on

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

Call me confused, but I can't see how your code snippet relates to the sample data you provided? You have two regex matching against /\s*SNMP\:.../, and one matching /Simple Network Management Protocol/ but the text SNMP does not appear anywhere in your data?

The other peice of information that is missing from your post is an indication of how you wish to use this data structure once it is built. What are you going to do with it?

A large amount of the content of the sample data is repetitious. Whilst it is reasonably easy to build a datastructure to hold that data as is, depending what information you wish to extract from it, it may well be better to consolidate the common elements of the repetitios parts. For example, within each of the sections of the data, all the OID's seem only to vary in the last 2 elements. It might therefore make sense, to eliminate the common prefixes and store the varient parts as sub keys of a hash, under a parent key of the invarient part. rather than stuffing the whole lot in an array. It would also appear that there is some relationship between the NAME: element and the paired OID: element? If this is the case, rather than storing them in parallel arrays, you could pair them as key/value pairs in a hash.

What, if any of the above observations of the data, have any relevance to the application at hand, only you will know, as you haven't explained what that application is. The point being is that there are several ways that you could build a structure to contain the data, but that choosing the best one for your application will depend upon how you need to process that data once you have encapsulated it.

Examine what is said, not who speaks.
1) When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.
2) The only way of discovering the limits of the possible is to venture a little way past them into the impossible
3) Any sufficiently advanced technology is indistinguishable from magic.
Arthur C. Clarke.

In reply to Re: Data Structure help by BrowserUk
in thread Data Structure help by Anonymous Monk

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
    [thao4]: I don't see where I can post my question. I am french so not good in English
    [erix]: go to the bottom of this page: Seekers of Perl Wisdom

    How do I use this? | Other CB clients
    Other Users?
    Others drinking their drinks and smoking their pipes about the Monastery: (8)
    As of 2018-02-21 10:01 GMT
    Find Nodes?
      Voting Booth?
      When it is dark outside I am happiest to see ...

      Results (276 votes). Check out past polls.