pro_perl thread: Re: user input in loops
I'm not sure exactly what you're after, but the following code may help
you:
#!/usr/bin/perl
while ($i ne "foo") { # infinite loop
print "A key was pressed!\n" if (<STDIN>);
}
Hope that helps you.
> Hi,
>
> Does anyone know of a way to detect and collect user input without
> interrupting the operation of a loop?
>
> (Am on Win98 with activeperl)
>
> (I want to terminate a loop gracefully; asking for <> just halts the
loop,
> which is no good.)
>
> Thanks,
> Peter
>
>
|





