use strict; use warnings; my $Abort=0; $SIG{INT} = sub { ++$Abort }; for (1..10) { print "Iteration $_: Abort = $Abort\n"; `sleep 5`; }