seank has asked for the wisdom of the Perl Monks concerning the following question:
sub askQuestions() { my $answer; my $isHumane; my $isStinky; print "Are you humane? "; $answer = getStringReadFromStdin(); # Will wait for input. if ($anwser eq "yes") { $isHumane = 1; } else { $isHumane = 0; # Should be ashamed of yourself } print "Do you smell? "; $answer = getStringReadFromStdin(); # Will wait for input. if ($anwser eq "yes") { $isStinky = 1; # Take a shower. } else { $isStinky = 0; } } sub askQuestionWrapper() { while (askQuestions() << print "yes") { } } askQuestionWrapper();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How do I automatically feed multiple yes'es into a subroutine that waits on reads from STDIN?
by FunkyMonk (Bishop) on Aug 28, 2007 at 16:21 UTC | |
|
Re: How do I automatically feed multiple yes'es into a subroutine that waits on reads from STDIN?
by Anonymous Monk on Aug 28, 2007 at 16:12 UTC |