Quote:
I have an old fashioned console (non-GUI) style perl program that asks dozens of questions. Incorporating readline might mitigate this a bit. What I would like to do is enhance the logic of this program to check ARGV before prompting the console (user) for information and then, after all the questions have been answered, artificially inject the completed command line into the shell history so the command can be re-run again with identical inputs by just hitting the up-arrow. This will save them from having to type all that stuff in again.
I don't think it's a good idea to hack the history to implement another hack in your program.
The ARGV stuff should be easy. Just check the length of ARGV array to see if you got enough command-line inputs. Also, you may want to validate the input data just as a good practice. Even if a user has supplied enough arguments, they could still be badly formatted. Also, be sure to display to the user what the inputs should be.
As for repeated executions of the same script with different inputs, you could easily modify the script to function in a loop, and provide some option for the used to update each value every time the loop runs. What I imagine is a prompt that will default to the previous values used for each parameter of the call, then ask for an updated value. If the user enters nothing, then it would just use the default. If the user enters some new value, it would use that new value.