# 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 } }