Perl script is not waiting for a .bat file to complete and continuing execution
<p>I am calling a bat file from a perl script.<br>
Since the bat file takes long time for execution, the perl script is not waiting for the bat file to complete and continuing execution from the next line. </p>

<p>Is there a way by which we can suspend the execution of the perl script until the bat file is finished execution and then resume once the bat file is done.</p>

<p>I wrote something like this:</p>

<pre><code>system ("start $bat_file");
print ("Hello");
</code></pre>

<p>So it prints hello even before bat file is finished.</p>

<p>Actually what I want to accomplish is:  </p>

<ol>
<li>My bat file creates some file</li>
<li>I want to copy those files to another location once the bat file is done.</li>
</ol>

<p>But as it is not waiting for the bat file to complete, the copy fails because it tries to copy a folder which does not exist as the bat file is still being processed and has not produced the output file.</p>

<p><strong>Note</strong> : Time to complete bat file is not fixed and changes everytime.</p>