use strict; $SIG{__DIE__} = sub { syslog("err", shift) }; for my $counter (1..10) { print("$conter\n"); }