$ob = Win32::SerialPort->new($PORT) ; $ob->baudrate(19200); $ob->databits(8); $ob->stopbits(1); $ob->buffers(4096, 4096); $ob->parity("none"); $ob->write_settings; $ob->save($CONF); #### $send="0xa10xa2"; # "0xa10xa2" $send="\x{a1}\x{a2}"; # "กข" $send=hex("a1a2"); # 41378 $send=hex("a1").hex("a2"); # 161162 $ob->write($send); #### # read from array foreach $array(@array){ $ob->parity($parity1); # change parity $ob->write_settings; $ob->save($CONF); $send=$char1.$char2.$char3.$char4.; # sending hexadecimal characters $ob->write($send); # receiving from COM port $gotit = $ob->streamline; die "got undef from streamline! $!" if (!defined ($gotit)); return if ($gotit eq ""); if($gotit eq $char5){ # is $char5 received? $ob->parity($parity2); # change parity $ob->write_settings; $ob->save($CONF); $ob->write($array); # send from array } }