You should change the line die "Device::SerialPort Aborted without match\n" unless (defined $data);
to read die "Device::SerialPort Aborted without match\n" unless (defined $bytein); But be careful because the 'lookfor' method causes Device::SerialPort to return an entire line (up to the first \n or \r)... If you intend to read -only- one char, you should check Device::SerialPort docs... There's plenty of examples =) Later.- ----- Original Message ----- From: Jeff Liu To: Papo Napolitano ; Beginners Sent: Friday, March 01, 2002 17:17 Subject: RE: perl serial port program Hi Papo, Thank you very much for your information. I can send to serial port from my script now. But when I try to read from the port, my script died and showed "Device::SerialPort Aborted without match". Do you have any idea about how can I fix the problem? My script is as followed. #!/usr/bin/perl use Device::SerialPort; $port = new Device::SerialPort("/dev/ttyS0"); $port->user_msg(ON); $port->baudrate(9600); $port->parity("none"); $port->databits(8); $port->stopbits(1); $port->handshake("xoff"); $port->write_settings; while (1) { $bytein=""; $port->lookclear; $port->write("Feed Me:"); $port->write("#"); while ($bytein eq "") { $bytein = $port->lookfor; die "Device::SerialPort Aborted without match\n" unless (defined $data); sleep 1; } print "$bytein\n"; } $port->close(); -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]