use Term::ReadKey; $SIG{INT} = sub{ReadMode 0;exit;}; ReadMode 4; while(1){ my $key;  while (not defined ($key = ReadKey(-1))) {    tu_was();    sleep 1;  }  if ($key eq "q") {last;} } ReadMode 0;