use POSIX qw(setsid); exit if fork(); # parent dies setsid; # make this a new process group ... rest of your program ...