use Device::SerialPort; my $port=Device::SerialPort->new("/dev/ttyS0"); $port->baudrate(9600); $port->parity("none"); $port->handshake("none"); $port->databits(8); $port->stopbits(1); $port->read_char_time(0); $port->read_const_time(1); my $readChars=0; # init my $readBytes=""; # init while(1) # yes, I know this thread is blocking { ($readChars, $readBytes)=$port->read(1); if ($readChars ne 0) { print("$readBytes"); # $Rval = $readBytes when attempting to share from thread to main window $readBytes=""; # re-init } }