Next Program Repair Shop 187

Loop Hoisting

        my $dir = $build_photo_path;
        opendir(DIR, $dir) || &err("can't open : $!"); 
        @all_files = readdir(DIR);
        closedir(DIR);
        foreach $key (keys %delete_list) {
          my (@files) = ();
          &header;
          @files = grep { /$key\.*/i } @all_files;
          if ($#files > -1) {
            foreach (@files) {
              unlink("$dir/$_") || &err("can't delete $_ : $!");
            }
          }
        }


Next Copyright © 2002 M. J. Dominus