Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Data Structure help

by BrowserUk (Pope)
on Mar 21, 2003 at 21:11 UTC ( #245007=note: print w/ replies, xml ) Need Help??


in reply to Data Structure 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.


Comment on Re: Data Structure help
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://245007]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2014-08-28 10:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (259 votes), past polls