twintriode
Technical User
I am stuck trying to figure out how to exit a simple while loop with keyboard input.
For example If I have a few functions that are being looped through, ie:
while ($exit ne 1){
&function1;
&function2;
&function3;
}
The thing is I want the three functions to keep looping (monitoring the system), until I press a key on the keyboard. So for example, to be used in the following way, loop until 't' is pressed on the keyboard, then break loop and display current cpu temp with another function.
I have tried things like:
do {
&function1;
&function2;
&function3;
} until ($in1 = <STDIN>);
but no luck it always breaks the looping to wait for input...
Any ideas would be much appreciated!
Thanks
For example If I have a few functions that are being looped through, ie:
while ($exit ne 1){
&function1;
&function2;
&function3;
}
The thing is I want the three functions to keep looping (monitoring the system), until I press a key on the keyboard. So for example, to be used in the following way, loop until 't' is pressed on the keyboard, then break loop and display current cpu temp with another function.
I have tried things like:
do {
&function1;
&function2;
&function3;
} until ($in1 = <STDIN>);
but no luck it always breaks the looping to wait for input...
Any ideas would be much appreciated!
Thanks