Writing this perl script, and now I have this silly I/O problem. I'm writing to a file, and changing 1 line.
So I have to overwrite the whole file with the new line that has been edited, and then add the old one.
But I get spaces between everyline! I am chomping every line, and I add \n to the end of the line that is being written to the file, but I just can't get the lines to "stick together."
flock(WRITEDATA,2);
foreach $entries2 (@indata2){
chomp($entires2);
($number, $name, $email) = split(/\|/, $entries2);
if ($name2 eq $name) {
print WRITEDATA "$number|$newname|$newemail\n";
This is just an example. My code is slightly different.
So each time I do the action this happens:
Number|Name|Email
Number|Name|Email
if I do it again this happens:
Number|Name|Email
Number|Name|Email
You see?
I had this kind of error in another file, and I didn't check it for a long time, and suddenly I had 5000(!!) lines! And I only had line 10 lines with actual contents. The others were "|||||||" or " ".
Can anyone help?
Thanks.
- kbtune
So I have to overwrite the whole file with the new line that has been edited, and then add the old one.
But I get spaces between everyline! I am chomping every line, and I add \n to the end of the line that is being written to the file, but I just can't get the lines to "stick together."
Code:
open(WRITEDATA, ">$members2"); flock(WRITEDATA,2);
foreach $entries2 (@indata2){
chomp($entires2);
($number, $name, $email) = split(/\|/, $entries2);
if ($name2 eq $name) {
print WRITEDATA "$number|$newname|$newemail\n";
This is just an example. My code is slightly different.
So each time I do the action this happens:
Quote:
Number|Name|Email Number|Name|Email
Number|Name|Email
if I do it again this happens:
Quote:
Number|Name|Email Number|Name|Email
Number|Name|Email
You see?
I had this kind of error in another file, and I didn't check it for a long time, and suddenly I had 5000(!!) lines! And I only had line 10 lines with actual contents. The others were "|||||||" or " ".
Can anyone help?
Thanks.
- kbtune