use Term::ReadKey; # ... do some stuff to the filehandle COMPORT ... # ... do the command that gives the long response ... # Clear the remaining input while (defined(ReadKey(0.1,COMPORT))) {} # ... do some other command ...