in reply to a problem with arrays and undeffing i think

Your description is a bit confusing:

the first time the files are uploaded everything works fine. when it uploads a second time...

If the files have been uploaded and moved the "first time", how is it possible that they come into play a "second time"?

If you really are looping over @FileList only once (as I suspect you should be), then there should be no problem -- though a better approach might be (untested code here):

my $src = "p:/charts/Sendtray/"; my $dst = "p:/charts/Sendtray/GONE/"; while (@FileList) { my $oFile = shift @FileList; $oFTP->put("$src$oFile") and move("$src$oFile","$dst$oFile") and &LogSentFiles($oFile) or warn "$oFile didn't move\n"; }
If you are going through this list a second time for some other reason, then of course, having set the array elements to undef will cause the error report when you pass the empty elements as part of a string for the FTP->put().

Replies are listed 'Best First'.
Re: Re: a problem with arrays and undeffing i think
by Anonymous Monk on Jun 17, 2002 at 05:49 UTC
    it only goes through the list once. theres a timer that is set to run &Outgoing_FTP but every hour when it starts uploading the files it will come up with the bad file descriptors error for the amount of files that were uploaded before, but, it won't print their file names, just a space.
      Have you done an independent check of directory contents before and after a given run? E.g. if it runs at 09:00, you should do a (gnu) "find" (or something equivalent) on the target directory a couple minutes before execution, and again a minute or so after execution.

      It may be that having %Dir tied with IO::Dir, while trying to modify the contents of the target directory, is causing unexpected side-effects (or failure to behave in the expected manner), and the problem is not with the @FileList array, but rather with the directory contents.