hi. i've wrriten an ftp program that every hour with check a directory for files and if there are any it will upload them then move them to a different folder. i get the file list like this.....
tie %Dir, IO::Dir, "p:/charts/Sendtray/." or &WriteToListView2("Error opening directory: $!");foreach (keys %Dir) { unless ($_ eq "." or $_ eq ".." or $_ eq "GONE" or $_ eq "") { push(@FileList,$_); } }
then upload then move.
the first time the files are uploaded everything works fine. when it uploads a second time i keep on getting bad file descriptor errors with a space instead of a file name. because i can't remove the files from @FileList because they're uploaded in a foreach loop, i undef them after they're uploaded and moved....
foreach $oFile(@FileList) { if ($oFTP->put("p:/charts/Sendtray/$oFile")) { if (move("p:/charts/Sendtray/$oFile","p:/charts/Sendtray/G +ONE/$oFile")) { &LogSentFiles($oFile); $oFile = undef; } } }
so i figure the error is because of the undef working unlike how i expect it to. does anyone now how to stop this from happening?
Edit kudra, 2002-06-17 Added code tags to one paragraph per ntc request, line to try to preserve author's intent of keeping the two code bits apart
In reply to a problem with arrays and undeffing i think by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |