jb_using_perl has asked for the wisdom of the Perl Monks concerning the following question:
And this is what prints:#!/usr/bin/perl use strict; use warnings; my @time=(4,12,16,8); LABELME: foreach my $t (@time) { $SIG{ALRM} = sub {print "timeout\n"; next LABELME}; print "Start $t\n"; alarm(10); sleep($t); alarm(0); print "done with $t\n"; } print "All Done!\n";
Thank you in advance for your help!Start 4 done with 4 Start 12 timeout Exiting subroutine via next at postalarm.pl line 8. Exiting eval via next at postalarm.pl line 8. Label not found for "next LABELME" at postalarm.pl line 8.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: using "alarm" with SIGALRM
by Anonymous Monk on Jul 27, 2009 at 17:51 UTC | |
by jb_using_perl (Initiate) on Jul 27, 2009 at 18:39 UTC |