Doing anything complicated in a signal handler is scary dangerous. The most common problem lies in memory management -- if your code attempts to malloc() a buffer when the main code is already in malloc(), your heap can get corrupted. It won't happen
all the time, and it may not even happen
often, but it can happen and it's very hard to debug.
The Signals section in Chapter 16 (IPC) of the Camel explains the rationale for this further -- but the general rule of thumb is that your handler shouldn't do anything more complicated than updating a variable, e.g.
my $interrupted = 0;
$SIG{ALRM} = sub { $interrupted = 1; };