Next Program Repair Shop 207

The Condition that Ate Michigan

        Subject: Apply Regex In Place
        Message-ID: <1YVv7.64617$0x.22955187@typhoon.southeast.rr.com>
        sub each_file {
          if ( -T $_ ) {
            print "processing $File::Find::name\n";
            if ( open F, "< $_" ) {
              my $s = <F>; 
              close F;
              if ( open F, "> $_" ) { 
                $s =~ s/COLUMN1/COLUMN1/ig;
                print F $s;                
                close F;
              }
              else {
                print "Error opening file for write: $!\n";
              }
            }
            else {
              print "Error opening file for read: $!\n";
            }
          }
        }


Next Copyright © 2002 M. J. Dominus