Problem 2 Create a script using only Perl that first prompts the user for the exit condition (exit/quit/or blank space)
Posted: Sat May 14, 2022 7:51 pm
Problem 2
Create a script using only Perl that first prompts the user for
the exit condition (exit/quit/or blank space) and then goes into a
loop waiting for the exit condition.
The program screen output should look like this:
"Enter exit, quit or blank space to exit the program."
While in the loop, catch the control-c signal and keep track of
how many times the control-c key is pressed (this must not
cause your program to exit).
When an exit condition is given, using perl commands,
create/open a file named results.txt.
Write the number of times control-c was pressed after exiting
the loop and save the file. Make sure you handle the
file properly.
The file should look like this (depending on the results):
The user did not press control-c (this is the case if control-c
was not pressed before exiting)
The user pressed control-c X times (where X is the number of
times control-c was pressed)
Create a script using only Perl that first prompts the user for
the exit condition (exit/quit/or blank space) and then goes into a
loop waiting for the exit condition.
The program screen output should look like this:
"Enter exit, quit or blank space to exit the program."
While in the loop, catch the control-c signal and keep track of
how many times the control-c key is pressed (this must not
cause your program to exit).
When an exit condition is given, using perl commands,
create/open a file named results.txt.
Write the number of times control-c was pressed after exiting
the loop and save the file. Make sure you handle the
file properly.
The file should look like this (depending on the results):
The user did not press control-c (this is the case if control-c
was not pressed before exiting)
The user pressed control-c X times (where X is the number of
times control-c was pressed)