$sub = sub { exec "perl $0" }; $SIG{INT} = $sub; $SIG{USR1} = $sub; while(1) { print ++$counter, "\n"; sleep 1; }