# The following hack allows $SIG{INT} to work under Win32: my $child= fork(); if( defined $child && 0 == $child ) { # Child: exit( 0 ); } # Parent: my $go= 1; $SIG{INT}= sub { $go= 0; warn "Got INT\n" }; my $i= 0; while( $go && $i < 10_000_000 ) { $i++; } print "Done: $i\n";