> for(my $i = 2, my $j = 1; $i <= $last;$i++, $j++) { > if ($j ne $fileNames[$i]) { > print "Sending missing for file: $fileNames[$i]"; > &sendMissing($j); > &pause; > next; > }
You never close the opening bracket in the if statement. and your for is not perlish, more C code, but I won't attempt to clean it, I'm too beginner for (2..$last) #for the i replacement if ($_-1 != $fileNames[$_]) { # we can use != since it's only numbers print "Sending missing for file: $fileNames[$_]"; &sendMissing($_-1); } # your if ends there? &pause; # or that too is in the if? } I am really beginner so I'll let the gurus code your sub way better, but that was my try. seeing your for, it's like j is always one under i since you initialize it at 1 and i at 2. Etienne "Michael D. Risser" wrote: > > I've rewritten the algorithm, but it still is not working correctly. Files 1, > 2, 3, 4, 5 are all present, 6 and 7 are missing and 8 is present. > > When it gets to the first missing file (6) it skips right over 6 and 7 > without running the code in the if statement, but then runs the if statement > code for file 8. > > This has got me baffled to say the least, any help is greatly appreciated. > > for(my $i = 2, my $j = 1; $i <= $last;$i++, $j++) { > if ($j ne $fileNames[$i]) { > print "Sending missing for file: $fileNames[$i]"; > &sendMissing($j); > &pause; > 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+a2unfMI22yh57WZ51nKajSGi3kbRd+564ZdM3BC3tU > 30eaA/9uwrGaTCKUpku9Q7xOXRUTQOzPKMuUkGrHK84Fea8BhRYm3P/im6+mgKPu > OeAZuxTX3KD8WyTz3wPc3C9RVkcOeii90r8AbztYFa3jq7ryAxXuIAJClDyvmVxz > 0i0/QsUG7Qmh3bSqSEE8j0wS1d+oCK0vys/kzPQu4BlSIZYlArQ9TWljaGFlbCBE > LiBSaXNzZXIgKFNvZnR3YXJlIEVuZ2luZWVyKSA8bWljaGFlbEB2aXNpb25wcm8u > Y29tPohXBBMRAgAXBQI7gq8QBQsHCgMEAxUDAgMWAgECF4AACgkQ/ikO9QMSg3cj > CwCfUw/OvLdfH3J6wDkgJkgwIZdJgmgAn1PAfxKjgiFXcteIpUtN6s988k1CuQEN > BDuCrxIQBADw8yDbbWdO9pvyUpdWjWxTBBFo9eQexJFFap4b9KcpWDJWawZ6S/HU > Cn+7zfbFb43AZa21mlon/vr7nwvlll7P/fa9S4kvk5twM8PcwM9O9yVxhOZeInXR > NUBzqjpK8FfRZgt1TaOz/CpdacNAJ9i2cShvH6wcCbHxGL9rjAu+IwADBgQA0t8p > 1ivBcABEmK4o+r5+uXZoQ4jUzDDN5bZmddQOQhyyMX/JUeBX7gxQ7r2cYJHIlcN+ > FCeqUHLmgQ/Ky+gze61Yr+FeEBJ4EPklkHWu3RoS4aKlEtU688nm+8Mfph6nYl+n > HzmaZjf5hz/mqvs5bzBCrw+xSSjNhJBrmj8qzIqIRgQYEQIABgUCO4KvEgAKCRD+ > KQ71AxKDd2/JAJ9vnTOSbmB2XceA4gBaOsZg06s5lQCfYfRtXoy/Mbw82eS19NE/ > w9t+V8g= > =J9H/ > -----END PGP PUBLIC KEY BLOCK----- > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- Etienne Marcotte Specifications Management - Quality Control Imperial Tobacco Ltd. - Montreal (Qc) Canada 514.932.6161 x.4001 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]