C:\test>copy con answers.txt y n ^Z 1 file(s) copied. C:\test>type tobeautomated.pl my $count = 0; while ($count < 2) { $count ++; print "Question? y/n: "; chomp(my $answer = <>); print "You said `$answer`\n"; } C:\test>type answers.txt | perl tobeautomated.pl Question? y/n: You said `y` Question? y/n: You said `n` C:\test>