$sub = sub { exec "perl $0" }; $SIG{INT} = $sub; $SIG{USR1} = $sub; print ++$counter while 1;