Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!yale!cs.utexas.edu!evax!utacfd!letni!mic!convex!barn From: barn@convex.com (Tim Barney) Newsgroups: comp.lang.perl Subject: trouble setting alarm Summary: trouble with simple alarm call. UBD? Keywords: alarm Message-ID: <1991Mar25.172223.28322@convex.com> Date: 25 Mar 91 17:22:23 GMT Sender: barn@convex.com Distribution: usa Organization: Convex Computer Corporation, Richardson, Tx. Lines: 23 Nntp-Posting-Host: convex1.convex.com Usually I have trouble getting up when my alarm goes off. Today, I'm having a lot of trouble just trying to set it! I keep getting syntax error in file e12 at line 4, next 2 tokens "alarm 60" Execution aborted due to compilation errors. Where is my mistake? It seems to me to be according to The Book....... tim_ #!/usr/bin/perl $SIG{'ALARM'} = 'sighandler'; # also tried alarm(60); , $n = alarm(60);, and $n = 60;alarm($n); alarm 60 ; for ($i=0;$i<200000;$i++) { $j = $i-1;} print "complete \n"; exit(0); sub sighandler { local($sig) = @_; print "caught it now! $sig\n"; exit(1); }