Am I correct in understanding that you want to communicate with another program, to send information back and forth? Or do you mean that you want to listen on some arbitrary port, and then act on what you find?
If I were you I'd look at IO::Socket, and use that to open a TCP/Ip port, which you can use either to communicate with another program, or listen in on the port "SNMP event messages" go to. If you're looking for a good book on the ins and outs of network programming, I would recommend Network Programming With Perl, which is available on Safari.
Want to support the EFF and FSF by buying cool stuff? Click here