Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Process a file one by one.

by ig (Vicar)
on Sep 04, 2009 at 05:46 UTC ( #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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://793367]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2018-03-23 07:50 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (288 votes). Check out past polls.