in reply to start process in bg, get child PID
fork returns the PID of the child process in the parent (and 0 to the child process), so if I read you right, this ought to do it:
my $pid = fork or exec @whatever;Update: In light of the other reply ... if you want to check that the fork succeeded, you need to check for definedness, not truth:
defined(my $pid = fork) or die "No fork: '$!'"; if ($pid==0) { # child exec @whatever or die "No exec: '$!'"; } # parent
print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!
|
|---|