in reply to Advice on script

Consider using Net::Packet to do your Layer 2 and 3 decoding, and specifically Net::Packet::CDP for CDP, rather than rolling your own.

In addition, you can improve upon your sub "enum_capabilities" considerably, by using a hash keyed using the decoded Capability.

            "Battle not with trolls, lest ye become a troll; and if you gaze into the Internet, the Internet gazes also into you."
        -Friedrich Nietzsche: A Dynamic Translation