On Mon, 29 Mar 2004 18:38:48 +0530
"T.S. Ravi Shankar" <[EMAIL PROTECTED]> wrote:
> At reaching a certain point in my perl program, I need to run a
> process( say XYZ ) using SYSTEM command. The result file that this
> process would produce will be result.<process_id>. I will have to
> wait until this result file is produced & then proceed extracting
> certain things from this file.
>
> I am implementing this as :
>
> foreach $check (@run) {
>
> $pid=fork;
> if($pid == 0) {
> exec("XYZ -a $check");
> }else{
> $pid1=wait;
> }
The above works, but it is equivalent to:
system("XYZ -a $check");
You should check the return value of system. A non-zero value means the
forked program returned a non-zero exit status which depending on what
you do with the output may or may not be an error.
--
Smoot Carl-Mitchell
Systems/Network Architect
email: [EMAIL PROTECTED]
cell: +1 602 421 9005
home: +1 480 922 7313
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>