Do any of you have any perl scripts that do this? I would like to look at your logic either for a serial or usb port.
Based on an upcoming but unlikely need I may have, I thought I would give google a look, first hit lays some ideas out pretty easily:
http://aplawrence.com/BGarlock/logger.html
http://search.cpan.org/dist/Device-SerialPort/SerialPort.pm
What exactly do you need to do?