On Jun 14, 6:54 am, [EMAIL PROTECTED] (Anand Kumar) wrote: > I would like to know if there is any possibilty to handle a situation where > in while executing a perl script if i press a Control-C (or terminate the > execution explicitly) then my code should be in a position to handle it and > display a predefined message(or specifically execute predefined code for > cleanup) and then actually exit the code execution.
CTRL-C tells the shell to send a SIGINT to the currently executing process. Therefore, all you need to do is have your program define a SIGINT handler: $SIG{INT} = sub { print "Nyah-Nyah, you're CTRL-C doesn't scare me!!\n"; }; Paul Lalli -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/