in reply to Re^2: Is there a way to halt the program until an enter is pressed?
in thread Is there a way to halt the program until an enter is pressed?
... print "Press <Enter> to continue, or 'q' to quit: "; my $input = <STDIN>; exit if $input eq "q\n"; ...
(Note that <> reads lines, so - strictly speaking - they'd have to enter q<Enter>... In case that could be an issue, you might want to choose a different wording for the prompt.)
Or tell them to use Ctrl-C.
And make a subroutine out of the snippet if you need it more than once.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Is there a way to halt the program until an enter is pressed?
by Anonymous Monk on Mar 14, 2011 at 00:38 UTC | |
by GrandFather (Saint) on Mar 14, 2011 at 00:43 UTC | |
by Anonymous Monk on Mar 14, 2011 at 00:47 UTC | |
by GrandFather (Saint) on Mar 14, 2011 at 00:50 UTC | |
by Anonymous Monk on Mar 14, 2011 at 01:05 UTC | |
|