in reply to How do I automatically feed multiple yes'es into a subroutine that waits on reads from STDIN?
You could redirect STDIN to a pipe from within the script.
You could redirect STDIN to a pipe from outside the script.
perl wrapper.pl | perl game.pl
You could redirect STDIN to a buffer.
{ my $answers = "yes\nyes\n"; local *STDIN; open STDIN, '<', \$answers; # Requires Perl 5.8.0 askQuestions() }
You could tie STDIN.
- ikegami
|
|---|