use IO::Select; use IO::Handle; $COM_PORT = "COM1"; my $Serial; #system("mode com1 baud=9600 stop=1 data=8 parity=n rts=on dtr=on"); #open $Serial,"+<", "$COM_PORT" or die "failed to open com port\n"; sysopen $Serial,"$COM_PORT", O_RDWR|O_NDELAY|O_NCOTTY or die "failed t +o open com port\n"; $sel = IO::Select->new; $sel -> add($Serial); if($sel -> exists($Serial)) { print "Handle exists \n"; } print $Serial "\n"; my $timeout = 0; if (my @ready = $sel -> can_read(0)) { print "Ready to read! \n"; } if (my @ready = $sel -> can_write(0)) { print "Ready to write! \n"; } if(my @ready = $sel -> has_error(0)) { print "Exceptions found! \n"; } close ($Serial); print "Finished... \n";