$A=1; $B=1;

while(1)
   { if ($A==1){$B=0,$A=B}
    if ($A==0){$B=1}
  if ($A==$B){last
  }else{$A=$B}}
 
