use strict; use warnings; my $pos; $SIG{ALRM} = 'doReport'; alarm (2); eval {doFail ()}; sub doFail { while (1) { $pos = 1; $pos = 2; $pos = 3; $pos = 4; } } sub doReport { my ($package, $filename, $line, $subroutine) = caller 0; print "$line, $subroutine (pos = $pos)\n"; exit; } #### 15, main::doReport (pos = 2)