my @fileNames = (".","..",1,2,3,4,5,6,7,8,9); #assuming that's what the readdir gives.
splice (@fileNames,0,2); #removes the . and .. foreach(@fileNames){ if (!-e $_){ print "Sending missing for file: $_"; sendMissing($_); pause(); } } I'm not sure we can use the !-e (-e test existence of a file) Etienne "Michael D. Risser" wrote: > > On Friday 16 November 2001 01:36 pm, Etienne Marcotte rambled: > > > 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. > > Actually that closing bracket IS for the if statement, it just didn't get > indented in the cut & paste :-), there is more code in the for statement > following the if. > > > and your for is not perlish, more C code, but I won't attempt to clean > > it, I'm too beginner > > That comes from asking a C++ guru for help ;-) > > > 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. > > $i gets initialized to 2 so that it skips . and .. produced by reading the > filesnames into an array (I'm sure theres a better way, but this works ;-)), > $j starts at 1 since the first filename should be "1" > > I can send the whole script if need be, but it is rather long :-) > > -- > 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/TECDESWsS2P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+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]