songahji has asked for the wisdom of the Perl Monks concerning the following question:

I might be barking at the wrong tree. Let's say I am processing thousands of files. A simple processing

like

foreach $f (@files) { open IN "$f" or die "$f, $!\n"; { local $/; $str = <IN>; } close IN; $str =~ s/old/new/ig; open OUT ">$f.new" or die "$f.new, $!"; print OUT $str; close OUT; }
Dos windows pops up a message could not write permission denied on random file.

But it works well when the list has few files. Weird?

Cheers,
Hanny J

Replies are listed 'Best First'.
Re: Permission denied on network drive
by trammell (Priest) on Apr 28, 2005 at 20:54 UTC
    A guess: is it possible that your list has duplicate filenames, and you're trying (and failing) to open duplicate output files?
      The list has unique elements, I got them from readdir.
Re: Permission denied on network drive
by ikegami (Patriarch) on Apr 28, 2005 at 22:18 UTC

    Under FAT, root directories have a limited number of entries. If you try to create too many files in the root directory, you will run into problems.

    It would be nice if you gave us the complete, exact error message including what's in the title bar of the popup. perl doesn't create popup error message, so it would be an error message from the Operating System. In fact, that error sould a lot like a memory protection fault!

      I apologize to mislead you.
      I was running perl from dos prompt and after 40 minutes running the message appear and just hang... i am guessing memory limitation. But I have a gig memory, weird?

      Would it be possible that it comes from the faulty network connection?

      also I could not always reproduce the error.

Re: Permission denied on network drive
by gman (Friar) on Apr 29, 2005 at 16:19 UTC
    You did not state if this was a network shared drive.
    If so is it posible that you are running out of drive space?
    Most inportantly, can you copy these files manualy?
      Disk space is plenty.
      Yes, I can copy them manually.

      would it be possible that it's a windows issue?