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
system "perl download ../downloads/files_download/$_ 1>/tmp/$_.log 2>/
+dev/null &\n ";