Perl's builtin function alarm only allows one 'alarm' to be in operation at a time. If you want multiple alarms, you need some wrapper code: