in reply to best way to keep track of who's friends with whom
You could store it as a lists of friends-IDs accessible by ID, in perl that would be a Hash of Arrays (or even a Hash of Hashes).
Or as nodes of IDs with pointers to any friend-node, which is maybe what you meant with node-segment. But although pointers aka links are available in perl and could be stored in a Hash of Arrays too, it has no advantages over the first mentioned approach that I can see. And it is less natural to use in perl. And you would have to store the ID of the user into the first entry of the array so you know who it is when you access a friends list coming from a link instead of the hash, which is mayor badness and a recipe for creating inconsistent data structure
The first approach also translates naturally to database storage in a relational database.
Examples of using the data structure Hash of Arrays can be found here and here in perldoc
|
|---|