title: How to stop input in Perl?
body: <p>I'm making a reflex game. Here's the output - </p>
  
  <pre><code>__________________________________________________________________________
  Reflex game initiated. Press ENTER to begin the game, and then press ENTER 
  after the asterisks are printed to measure your reflexes!.
  
  
  *************************
  
  Your result: 0.285606 seconds.
  logout
  
  [Process completed]
  __________________________________________________________________________
  </code></pre>
  
  <p>There's one small problem though - There's 0-10 seconds (based on a random variable) after you press enter to start the game and before the stars are printed. During that time, if the player presses ENTER, it's logged as their reflex time. So I need a way to stop my code from reading their ENTER button before the stars are printed. The code -</p>
  
  <pre><code>#!/usr/bin/perl
  
  use Time::HiRes qw(sleep);
  use Time::HiRes qw(gettimeofday);
  
  #random delay variable
  $random_number = rand();
  
  print "Reflex game initiated. Press ENTER to begin the game, and then press ENTER after         the asterisks are printed to measure your reflexes!.\n";
  
  #begin button
  $begin = &lt;&gt;;
  
  #waits x milliseconds
  sleep(10*$random_number);
  
  #pre-game
  $start = [ Time::HiRes::gettimeofday() ];
  
  print "\n****************************\n";
  
  #user presses enter
  $stop = &lt;&gt;;
  
  #post game
  $elapsed = Time::HiRes::tv_interval($start);
  
  #delay time print
  print "Your result: ".$elapsed." seconds.\n";
  </code></pre>