thefid has asked for the wisdom of the Perl Monks concerning the following question:
BTW, I am currently looking into Proc::ProcessTable... thanks, mike#!/usr/bin/perl -w use strict; my $process = "perl"; my @output; my $kidpid; if ($kidpid = open(PIPE, "-|")) { # Parent process. Read data from the child. @output = <PIPE>; } else { # Child process. Execute the command. die "could not fork" if !defined($kidpid); exec ("ps", "-ef", "|", "grep", $process) or die "exec failed: $!"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: passing array arguments to exec()
by Kanji (Parson) on Apr 17, 2001 at 04:02 UTC | |
|
Re: passing array arguments to exec()
by Masem (Monsignor) on Apr 17, 2001 at 03:51 UTC |