Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: quiting program

by particle (Vicar)
on May 31, 2002 at 20:43 UTC ( [id://170830]=note: print w/replies, xml ) Need Help??


in reply to Re: quiting program
in thread quiting program

your code is probably better implemented as a closure. then there's no special variable in the same scope as your code.

{ my $num_ctrlc = 0; $SIG{'INT'} = sub { print "Got " . ++$num_ctrlc . " ctrl-c\n"; exit if $num_ctrlc > 2; } }

~Particle *accelerates*

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://170830]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-14 20:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found