while( 1 && $serialport ne "" && $errorwithserial == 0 ) { ... while( 1 && $errorwithserial == 0 ) {