sub sth($$) { $SIG{ALRM}=sub { goto SUBEND; #IE, when ALRM strikes # cut short execution of the routine and just return from #there }; #.... #.... alarm 10;# $sth->stuff(); alarm 0;# if I'm here, I can safely continue SUBEND: return; }