Checking for keyboard input without halting process
From: Zikester (ikeb_at_storm.ca)
Date: 04/29/04
- Next message: Rob Dixon: "Re: do problem"
- Previous message: Durai: "Running another program in current program"
- Next in thread: John W. Krahn: "Re: Checking for keyboard input without halting process"
- Reply: John W. Krahn: "Re: Checking for keyboard input without halting process"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: beginners@perl.org Date: Thu, 29 Apr 2004 02:53:26 -0400
I've racked my brain for an answer to this one. Probably real simple.....
I'd like to run a process reatedly until entering a character on the
keyboard (other than ^C). When the character is entered the process would
complete some final tasks and exit the program.
do {
# a process
$Keyboard_Input = (check_for_input);
} until ($Keyboard_Input);
# some final tasks
I've tried to use the standard input file <STDIN> without success.
I've tried
$Keyboard_Input = <STDIN>; which just halts the script until the Enter key
is pressed.
$Keyboard_Input = eof (STDIN); which halts until the Enter key is pressed
and then returns a null character thereafter
$Keyboard_Input = tell (STDIN); which returns a '0' character even if the
Enter key is pressed,
OK, so what am I missing here? Do I need to use something other than the
Standard Input File structure?
- Next message: Rob Dixon: "Re: do problem"
- Previous message: Durai: "Running another program in current program"
- Next in thread: John W. Krahn: "Re: Checking for keyboard input without halting process"
- Reply: John W. Krahn: "Re: Checking for keyboard input without halting process"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|