To find out if a value is a reference, just use ref()
One could store this data structure as a tree (and there are modules that help with this) but for your task a simple hash might be all you need. Just store for every machine and switch the switch and port it is connected to. So $connect{workstation5}='hpswitch3:2'; and $connect{hpswitch1}='Main Switch:01/01';
Advantages: No links to keep consistent, easy to write to disk, simple traversing. Disadvantage: Will get slow to ask more complex questions like 'which machines are connected below Main Switch 01/01?', if your machine pool gets above 1000 and you need to ask those questions a lot. But if all you want to do is note all changes, then this structure is as fast as anything
UPDATE: Small rewording of the disadvantageIn reply to Re: generating hashes of hashes
by jethro
in thread generating hashes of hashes
by mrnick1234567
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |