in reply to If logic fails foreach mistake

Hello all... Thank you very much... I found my mistake (I'm new to perl still on the learning curve)... The code listed below is what i am using... I would like to thank you Monks for taking the time to assist me... I have discovered that I enjoy using PERL... I have so much more that I want to discover with it...

Thank's Darrick...



sub get_logfiles {
 opendir (Directory, $pth) or die "Cannot Open Directory";
 @contemps = readdir(Directory);
 closedir(Directory);
 splice(@contemps, 0, 2);
 foreach (@contemps) {
  if (m/^[B|b].+.txt$/) {
   push(@contents,$_)
  }
 }
 undef(@contemps);
 sort(@contents);
 foreach $content (@contents) {
  $logfile = "$pth" . "\\" . "$content";
  if( -M $logfile < 1 ) { #less than 24 hours ago
  #if( -M $logfile < 13 ) { #less than 13 days ago
   open(FILE, "$logfile"); # open logfile for reading
   print "   ***$logfile is in specified date range - processing***\n";
   &do_log;
   &write_out;
   close(FILE);
  }
  else {print "   ***$logfile is out of date range - skipping***\n";
  }
 }
}