sub f {
local $SIG{ALRM} = sub { print "SIGALRM\n" }; # line 9
}
if (fork) {
# parent
f while 1;
} else {
The f while 1 will call f repeatedly and for ever. I don't know why you'd want to keep setting $SIG{ALRM} over and over again. I also guess that the local will use a small amount of memory each time....
Update: I apologize: I had missed the point that the mystery was that setting $SIG{ALRM} in the way shown seemed to expose the default setting, despite there being a previous setting replacing the default. While I'm at it, I can find no evidence to support the suggestion that the local might be eating memory, so I retract that entirely <blush>. (I think I'll go and have a little lie down, now.)