#!/usr/bin/perl -w use threads; $SIG{"INT"}=\&sigInt; my $thread=threads->create('test')->detach(); my $n = 100; 1 while --$n and sleep 1; sub test { my $n = 100; 1 while --$n and sleep 1; } sub sigInt { exit; }