my $lock = 1; $SIG{CONT} = sub { $lock = 0 }; while($lock) { sleep 1 } # Rest of your program