I want to open a file, modify it and then write back to the same file. This does not work, but I do not know why. Does asnyone know?
# Read the file in grep
open (INFILE,"c:/TREEINFO.WC"
or die "Error $f_file: $!";
@lines = <INFILE>;
close INFILE;
open (OUTFILE,">c:/TREEINFO.WC"
or die "Error $f_file: $!";
# Loop and print the subs value
foreach $line (@lines) {
$line =~ s! {2,}$!!;
print OUTFILE "$line";
}
# Read the file in grep
open (INFILE,"c:/TREEINFO.WC"
@lines = <INFILE>;
close INFILE;
open (OUTFILE,">c:/TREEINFO.WC"
# Loop and print the subs value
foreach $line (@lines) {
$line =~ s! {2,}$!!;
print OUTFILE "$line";
}