Hi monks

I have a two files in a directory, I need to read that directory and need to process each file that directory contains.Both the file contains database queries.What I did say that I opened that directory and read the directory and saved all the files names into an array. Then I used foreach loop inside of that and used the system command to process those files,When those files get process at the same time it also update a log file says that query executed successfully. I need to process each file one by one only. When I check the log files both the log files get updated simultaneously, I thought that after a file completes another file will get process, but both the file get processing. how to process those files one by one.

Below is that foreach loop

foreach(@files{ system "perl download ../downloads/files_download/$_ 1>/tmp/$_.log 2>/ +dev/null &\n "; }
Update:

Title updated.


In reply to Process each file one by one. by vinoth.ree

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.