merrymonk has asked for the wisdom of the Perl Monks concerning the following question:
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 change +d } print "\nEND\n"; sub tsktsk{ $loop_test = 0; print "[tsktsk] called\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Interrupting a loop
by choroba (Cardinal) on Jul 28, 2024 at 08:34 UTC | |
by etj (Priest) on Jul 28, 2024 at 13:43 UTC | |
by cavac (Prior) on Jul 29, 2024 at 05:09 UTC | |
by merrymonk (Hermit) on Jul 28, 2024 at 13:42 UTC | |
by merrymonk (Hermit) on Jul 30, 2024 at 10:32 UTC | |
by jdporter (Paladin) on Jul 28, 2024 at 14:08 UTC |