|
|
Back to UserFriendly Strip Comments Index
| Programming analysis question for y'all.. |
by romandas |
2006-04-12 07:15:36 |
Pardon me if this seems a bit naive, but I have not really had any formal programming analysis training.
I am trying to figure out the best (most efficient) way to store and access three to four pieces of related information during the course of a Perl script running.
The script currently collects the IP, MAC address and hostname (if available) from a series of machines on our LAN. I would like to store this information in such a way that comparisons keyed on IP can be managed quickly.
I initially thought a hash would work, however IIRC hash values have to be scalars not lists, and since I need to store both MAC address and hostname, a scalar just won't do. If I am wrong on this, please let me know.
I then thought I would create an array of objects to represent each node on the network, with IP, MAC address and hostname as properties, but I do not see an easy way to find a specific node without searching through the entire array. Would a hash of objects work? Is a object reference a scalar value?
Would all this be better suited as a database, a la DBM::Deep?
Thanks for any input; it's appreciated |
|
[ Reply ] |
|
I'd suggest a DB for expansion. | by jayfarm | 2006-04-12 07:18:08 |
|
Interesting enough, I just read a bit in the Camel | by romandas | 2006-04-12 07:30:40 |
|
Use a hash of objects. | by kahuana | 2006-04-12 07:40:56 |
|
Please ignore the superfluous 'be' | by kahuana | 2006-04-12 07:43:22 |
|
Well, the information will be written to a file | by romandas | 2006-04-12 07:48:02 |
|
DB takes care of "write-to-file". | by kahuana | 2006-04-12 07:56:12 |
|
Yes, elements of aggregates in Perl are scalars | by hobbs | 2006-04-12 07:55:07 |
|
|
[Todays Cartoon Discussion]
[News Index]
|
|