title: Flushing Perl STDIN buffer
body: <p>Is there any way to clear the STDIN buffer in Perl? A part of my program has lengthy output (enough time for someone to enter a few characters) and after that output I ask for input, but if characters were entered during the output, they are "tacked on" to whatever is entered at the input part. Here is an example of my problem: </p>
  
  <pre><code>for(my $n = 0; $n &lt; 70000; $n++){
     print $n . "\n";
  }
  chomp(my $input = &lt;STDIN&gt;);
  print $input . "\n";
  </code></pre>
  
  <p>The output would include any characters entered during the output from that for loop. How could I either disable STDIN or flush the STDIN buffer (or any other way to not allow extra characters to be inserted into STDIN before calling it)?</p>