$SIG{ALRM} = sub { exit 0 }; # trap an alarm and assign a sub to exit alarm 60; # trigger an alarm after 60 seconds MainLoop;