On 1/4/07, Saurabh Singhvi <[EMAIL PROTECTED]> wrote:
Hi all,

I wanted to know a way of taking a time limited STDIN. Say for eg
after 3 seconds, the STDIN should stop waiting and move forward.

How do I do this??

I was trying with

unless ($child) {
        sleep($waittime);
        `echo "\n"`;
        exit 0;
    }
$ans = <STDIN>;

You can do this using the alarm function and an eval block as
described here: <http://perldoc.perl.org/functions/alarm.html>

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to