Thanks a lot ! That does it :)
On 1/4/07, Dave Gray <[EMAIL PROTECTED]> wrote:
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>