#/usr/local/bin/perl
$j=4;
for ($i=1; $i<$j; $i++)  {
    &clear_stdin;
    print "response: ";
    $response = <STDIN>;
    print "\n response was: $response\n";

    sleep 10;
    }
exit;

sub clear_stdin  {
    getc while ($ans = &key_ready);
    print $ans;
    }

sub key_ready  {    # from perl FAQ number 2.8
    local($rin, $nfd);
    vec($rin, fileno(STDIN), 1) = 1;
    return $nfd = select($rin,undef,undef,0);
    }

