"John W. Krahn" wrote: > > Bruno oliveira wrote: > > > > Hi! > > Hello, > > > I want to start a program in perl but i need to keep > > the pid to be able to kill it in the future. > > > > For exmple: > > > > system("top &"); > > > > this would start "top", but then i wouldn't be able to > > identify the process in order to kill it. Is there a > > way to do this (other than using fork) ?
system() uses fork. perldoc -f system system LIST system PROGRAM LIST Does exactly the same thing as `exec LIST', except that a fork is done first, and the parent process waits for the child process to complete. > defined( my $pid = fork ) or die "Cannot fork: $!"; > $pid and exec 'top' or die "Cannot exec 'top': $!"; Sorry, that should be: defined( my $pid = fork ) or die "Cannot fork: $!"; $pid or exec 'top' or die "Cannot exec 'top': $!"; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]