in reply to lexical variables and signal handlers

If you want to trigger from the alarm, you'll want to use $SIG{ALRM} rather than INT. You don't have to put $var global it just needs to be in the same scope as the signal handler so you could have
alarm(1); while(1) { my $var = "wibble"; $SIG{ALRM} = sub { die "borked on $var"; }; } alarm(0);
That said I assume that you want to a bit more than just trigger an alarm so it might help if you could give it bit more context