Hello oh wise Perl monks. I have a question that I can not seem to find an answer to and I hope to take a sip from your fountain of knowledge.
I am currently writing a script that issues a system command and the command itself brings up a prompt like this after a few seconds
Do you want to read the file? 1 for yes, 2 for no. (Default is 2)
My question is how would I issue my script to say yes once this comes up? I have tried with the following code, but seem to be having issues, primarily where the if statement does execute correctly, however the issuance of the automated user response is far to late. This appears to be due to the script returning user control and halts and waits for the user to enter anything, including just pressing the enter key. Any help is appreciated!
$output = `Command foo`;
if ($output = ~/Do you want to read the file?/)
print "Correct String detected."; #detects that the if stateme
+nt was executed.
print "Unsuccessful detection of String." #detects that the if
+ statements was unsuccessfully executed.