Hello, I am writing a perl program that has to be able to open 16 files using another program in C (filename is passed by the command line) and wait until all files are completed before continuning the perl program. I have researched online and found fork() and wait(). I have added them into my perl program and they create the process, however they do not wait until all files are completed before continuing. Please help.
#This is just the command to be called in execu my $inputfile="perloutput"; my $endfile=".txt "; my $smb="> "; my $outputfile="output"; my $smb2="&"; while ($index<16) { my $testpath="chirp_md5sum "; $testpath=$testpath.$inputfile.$index.$endfile.$smb.$outputfile.$ +index.$endfile.$smb2; chomp $testpath; print ("$testpath \n"); $id=fork(); if($id eq 0) { exec ($testpath); wait(); exit(); } $index++; }

In reply to Fork and wait question by chris68805

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.