vinoth.ree has asked for the wisdom of the Perl Monks concerning the following question:
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
Update:foreach(@files{ system "perl download ../downloads/files_download/$_ 1>/tmp/$_.log 2>/ +dev/null &\n "; }
Title updated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Process a file one by one.
by graff (Chancellor) on Sep 04, 2009 at 05:49 UTC | |
|
Re: Process a file one by one.
by ig (Vicar) on Sep 04, 2009 at 05:46 UTC | |
by vinoth.ree (Monsignor) on Sep 04, 2009 at 06:43 UTC | |
by Anonymous Monk on Sep 04, 2009 at 07:06 UTC | |
by vinoth.ree (Monsignor) on Sep 04, 2009 at 07:20 UTC | |
|
Re: Process each file one by one.
by vitoco (Hermit) on Sep 04, 2009 at 13:30 UTC |