my $pid; $SIG{CHLD} = sub { wait }; if ($pid = fork()) { # Master print "Process was started in background." return; } else { # Child exec "my_program"; }