#!/usr/bin/perl alarm 3; # have the OS send myself a SIGALRM after 3 seconds for (1..100) { print "sending line $_\n"; select undef, undef, undef, 0.5; } print "Done.\n";