I have a script which in part takes a list of files in a directory (the name 
of each file is a number), sorts them numerically, and then runs through each 
file checking to see if any are missing, and performing a set action if it is 
missing, or a different action if it is present.

My problem is my script is only performing the "missing" action, regardless 
of whether or not the file is present. 

Could some one tell me where I went wrong?

chdir($ARGV[0]) or die "Unable to enter directory: $!\n\n\n";

# Get a list of filenames to process
opendir(THIS, '.') or die "Cannot open directory: $!\n\n\n";
my @filenames = readdir(THIS) or die "Unable to get list of files: $!\n\n\n";

# Need to sort the filenames so that they get processed in numeric order;
# this ensures that bugs are automatically assigned the right bug ID #

my @fileNames = sort {$a <=> $b} @filenames;
        
# Get the number of files to process
my $numFiles = @fileNames;
    
#|--Remove Before Flight-->
    print "Number of files to process: $numFiles\n";
    print "Press any key to continue, Ctrl-C to exit\n";
    chomp(my $in=<STDIN>);
#<--Remove Before Flight--|
        
my $j = 1;
# Go through each file we found
for(my $i = 0; $i <= $numFiles;$i++) {
    if ($file != $j) {
        print "Sending missing for file: $i";
        &sendMissing;
        $j++;
        next;
    }
}
-- 
Michael D. Risser
Software Engineer/Linux Administrator
=============================
Machine Vision Products, Inc.
www.visionpro.com
[EMAIL PROTECTED]
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

mQGiBDuCrxARBADE9hdFrBY4oQG8dnGZo6HV1pPXdiS1yVhDA1Hp0nTcmhsAdBtu
udBPkwwrVKATJYWQsRYBwbjE9WhyeGKXW95BkeUfDQo6YJBGBaeZSnfJhugdnoEv
+UB3c7McRenM6dN0oeDBWhcylTMpdUEbM9BG3pHUrKIh/TECDESWsS2PRwCgkGMy
HTSPVa3xzwAyt4C5FPINSkcEALHAysCwpYou3n1BOjjIR/lc2Wg9jMDxCL5Kf5qh
JIfvPu5Ew/NjkcTtoUrF8Ag4++3/D9jaHpFiUvp5xKtd/CjI+zQmWYvan3Qa5D6D
ZXNAvQzDpHMQ0PNed4lD6+a2unfMI22yh57WZ51nKajSGi3kb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