Max Clark wrote:

> I'm looking for a way to run an operation (like a while (<>) loop for
> example) until the user presses "ctrl-c". Except instead of ending the
> perl script I want to trap the "ctrl-c" and present the user a menu of
> options.
 
This is very minimal:

,----
|   $SIG{INT} = sub { warn "ctl-c pressed!\n" };
|  
|   while (1) {
|         print "hi\n";
|         sleep 1;
|   }
`----

If you run that it'll print "hi" forever, and a message when you press 
ctl-c. You'll have to kill it to stop it (something to think about)

Try "perldoc -q trap signals" also, as well as the docs Paul pointed you at.

--
Best Regards,
Daniel

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to