On Sat, 2008-08-09 at 14:42 -0700, Michael Alipio wrote:
> Hi,
>
> I have a sub that returns a value and inside it runs a loop that displays
> something on the screen, say a list of numbered items. Now what I want to do
> is if the item i'm interested appears on the screen, the user can hit any key
> and the program will exit the sub and return what ever it is supposed to
> return.
>
> Any idea how to accomplish that?
>
>
>
>
Yes. Fork of a child process, use Term::ReadKey to set STDIN to respond
immediately on key press. When that happens, the child process signals
the parent, which breaks the loop.
See:
perldoc perlipc
perldoc Term::ReadKey
--
Just my 0.00000002 million dollars worth,
Shawn
"Where there's duct tape, there's hope."
"Perl is the duct tape of the Internet."
Hassan Schroeder, Sun's first webmaster
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/