K
Karen
Hi,
I have a perl script that modifies a regular text file, for some
reason it adds an extra blank line at the end of the file.
I've tried to remove it with chomp(), or adding the \r character but
doesn't work.
So far I read the file into an array and try to delete it from there
(the blank line is @file2[107]) I added the following code but doesn't
do anything.
## Rest of the code
$file2="C:\\stocker\\$outputFile";
if(open(FK,"$file2")){
close FK;
tie @file2, "Tie::File", $file2;
splice @file2,107,1; #remove record, starting at record 107
} else{
print "Can't open the file $file2";
}
##
Please help me with some suggestions. I just need to get rid of the
last line in a text file.
Thanks,
-Karen-
I have a perl script that modifies a regular text file, for some
reason it adds an extra blank line at the end of the file.
I've tried to remove it with chomp(), or adding the \r character but
doesn't work.
So far I read the file into an array and try to delete it from there
(the blank line is @file2[107]) I added the following code but doesn't
do anything.
## Rest of the code
$file2="C:\\stocker\\$outputFile";
if(open(FK,"$file2")){
close FK;
tie @file2, "Tie::File", $file2;
splice @file2,107,1; #remove record, starting at record 107
} else{
print "Can't open the file $file2";
}
##
Please help me with some suggestions. I just need to get rid of the
last line in a text file.
Thanks,
-Karen-