use strict; use warnings; my ($loop_test, $cou); $loop_test = 1; $cou = 0; while($loop_test > 0) { # something which the lets the user set $loop#_tes to 0 $SIG{INT} = \&tsktsk; sleep(5); $cou = $cou +1; print "end sleep - count $cou\n"; # sub to do something - for exmaple see if a files mod time has changed } print "\nEND\n"; sub tsktsk{ $loop_test = 0; print "[tsktsk] called\n"; }