in reply to Asynchronous Program Spawning
... # time to start a separate process, but we want the parent to keep run +ning # (i.e. parent and child run simultaneously) my $childpid = fork(); if ( !defined( $childpid )) { die "couldn't fork: $!"; } elsif ( $childpid == 0 ) { # this is what the child does: exec( "other_program", @args ); # at this point, the other_program is running; it replaces # (has the same pid that was originally assigned to) the # "child copy" of the current script } # and here, the parent continues what it was doing...
But as you have seen, it also works to simply include the ampersand at the end of the command line passed to "system()".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Asynchronous Program Spawning
by salva (Canon) on Feb 12, 2006 at 13:15 UTC |