!/usr/bin/perl -w use strict; $| =1; #turns off output buffering #without this the "die" message might not be #seen due to STDOUT buffering $SIG{ALRM} = 'alarmhander'; alarm(1); while (1) { print "blah...anything..lot's of lines\n"; } sub alarmhander { die "ooops bailing out with die\n" }