http://www.perlmonks.org?node_id=10594

marcos has asked for the wisdom of the Perl Monks concerning the following question:

I would like to write a simple network sniffer in perl. The script should take the protocol (I would like to have the possibility to choose either udp or tcp) and the port from the command line, and then print out everything that goes through that port. I've seen a perl script that uses 'tcpdump', but I would like to write everything in perl. I wrote some simple script using IO::Socket::INET, but I don't know how to write a scrpt that works like a sniffer.
TIA
marcos