Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Process a file one by one.

by ig (Vicar)
on Sep 04, 2009 at 05:46 UTC ( [id://793367]=note: print w/replies, xml ) Need Help??


in reply to Process each file one by one.

Since you haven't shown the value of @files it is difficult to be certain what your program fragment does. You should examine (print them or use the debugger) the values of @files to ensure they are what they should be and what you think they are. If they are not, you will have to correct the code that sets @files.

If @files has reasonable values (i.e. simple file names, no wildcards, no shell metacharacters, etc.) then your program fragment looks like it will run your download script once for each file. What is it that makes you think that both log files are updated simultaneously? If it is that they have the same modification time, it may be that your program runs to completion within one second. If you want to ensure that the files are being processed at different times and that the log files will have different timestamps, you can add a delay to your loop:

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

If that doesn't resolve your problem, then you should look at your "download" program.

Replies are listed 'Best First'.
Re^2: Process a file one by one.
by vinoth.ree (Monsignor) on Sep 04, 2009 at 06:43 UTC

    I already checked the @files, its contains only the file names nothing else

      You've said that before and you were mistaken, you need to prove it.

        Please tell me what I need to prove,do u need the files names?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://793367]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-04-18 17:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found