| Next | Program
Repair Shop ![]() |
207 |
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";
}
}
}
The entire function has been gobbled up by the ravenous if -T condition
Quick! Does that if have an else?
| Next | ![]() |
Copyright © 2002 M. J. Dominus |