I have a script which gets executed, but I require a loop which tells the process to sleep for 20-30 secs whilst a user runs a different test.
Once that test is completed then the user presses Enter to continue from where the script was halted. If Enter is not pressed within the 20-30 second period the script is to continue to run without user input.
I tried the following code but it pauses the script indefinitely – it does not continue after 20 secs, but it also does not accept Enter.
use Term::ReadKey;
ReadMode 4;
do {
sleep 20;
} until ( defined( $key = ReadKey(-1) ) );
ReadMode 0;