>> appends or in other words ADDS TO THE END OF the existing file. All the data lines are not being copied, they are simply being left there and new data added to the end. Here is a guide for you:
my $file = '/foo/file.txt';
open IN, $file or die "Can't read $file perl says $!\n";
my @lines = <IN>;
close IN;
for my $line (@lines) {
# do stuff with the lines
}
# rewrite the file in its entirity
open OUT, '>$file' or die "Can't write $file perl says $!\n";
print OUT $line[0]; # print out the first line from the old fil
+e
print OUT @other_stuff; # print whatever else you want
close OUT;
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
|