The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

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 jayfarm2006-04-12 07:18:08
    Interesting enough, I just read a bit in the Camel by romandas2006-04-12 07:30:40
      Use a hash of objects. by kahuana2006-04-12 07:40:56
        Please ignore the superfluous 'be' by kahuana2006-04-12 07:43:22
        Well, the information will be written to a file by romandas2006-04-12 07:48:02
          DB takes care of "write-to-file". by kahuana2006-04-12 07:56:12
  Yes, elements of aggregates in Perl are scalars by hobbs2006-04-12 07:55:07

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)