I want to write a script in perl that will define a value for a variable say "10". Then, it will ask user to enter the value through STDIN for that variable. If user, enters the value within a fixed TIME INTERVAL, then take that value, else continue the program by taking that default value of 10.
I had no idea how to do that. I thought of some thing like this.. $t=120 (for 120 seconds) decrease value of "$t" with every second, if user enters some value then come out of loop, and continue, else when $t becomes 0, take default value and continue. But, i dont have any idea of how can i decrease value of variable with time along with asking user for input.
I can do this, decrease value of variable with time, but within that, i am not able to take input.