At 8:18 AM -0700 2/20/10, Jon Forsyth wrote:
Hello,

How can I set a requirement for <STDIN> (e.g. require the <space> to
continue running the program)?

It is not clear what you are asking. Posting a sample program would really help.

If you are asking if it is possible to pause a program and wait for a specific user input, you can capture the input and test it:

  my $response = <STDIN>;
  chomp($response);
  exit unless $response =~ /whatever/;

One problem with this approach is that the user must enter a return to unpause the program. If you want the user to be able to enter a single character (other than a return), see, for example, 'perldoc -q single' "How can I read a single character from a file? From the keyboard?".



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to