This is a simple example of how to control a serial port using perl in linux.
For WIN32 systems please check out the Win32::Serial module.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| #!/usr/bin/perl use Device::SerialPort; my $port = Device::SerialPort->new("/dev/ttyUSB0"); $port->databits(8); $port->baudrate(19200); $port->parity("none"); $port->stopbits(1); while(1) { my $byte=$port->read(1); print "$byte"; } |