W
Wg
Hi,
I'm trying to add a new line to a file say "tmp_file1.txt" before
reading into that file. Here tmp_file1.txt is the destination file
into which I'm trying to copy.. Pasting code snippet. Is there
anything that I'm missing out here ..
sub create_tmp_file1()
{
# Pls note: the function recieve's the file handle of the
source file and passess on the file handle of the #destination file to
the sub routine that is called for inserting new line.. Attempt is to
give sufficient spacing #between reading from each source file..
my $inputFile = $_[0];
my $getLine;
open (TMP_FH, ">>tmp_file1.txt") or die "Unable to open file
tmp_file1 for writing ..\n";
print $inputFile."\n";
&addNewLine(\*TMP_FH);
while(<$inputFile>){
$getLine = $_;
print TMP_FH $getLine;
}
$getLine = "\x0C";
print TMP_FH $getLine;
# print TMP_FH "\x0c";
close (TMP_FH);
}
# Function that adds new line character..
sub addNewLine(){
my $fileName = $_[0];
my $count = 0;
# open TEMP_FH, ">>".$fileName or die "Failed opening $outputFile
file ...";
while($count le 30){
#print TEMP_FH "\n";
#print TEMP_FH " \n";
print $fileName " \n";
$count++;
}
# close(TEMP_FH);
}
Any pointer to this would be greatly appreciated..
-Wg
I'm trying to add a new line to a file say "tmp_file1.txt" before
reading into that file. Here tmp_file1.txt is the destination file
into which I'm trying to copy.. Pasting code snippet. Is there
anything that I'm missing out here ..
sub create_tmp_file1()
{
# Pls note: the function recieve's the file handle of the
source file and passess on the file handle of the #destination file to
the sub routine that is called for inserting new line.. Attempt is to
give sufficient spacing #between reading from each source file..
my $inputFile = $_[0];
my $getLine;
open (TMP_FH, ">>tmp_file1.txt") or die "Unable to open file
tmp_file1 for writing ..\n";
print $inputFile."\n";
&addNewLine(\*TMP_FH);
while(<$inputFile>){
$getLine = $_;
print TMP_FH $getLine;
}
$getLine = "\x0C";
print TMP_FH $getLine;
# print TMP_FH "\x0c";
close (TMP_FH);
}
# Function that adds new line character..
sub addNewLine(){
my $fileName = $_[0];
my $count = 0;
# open TEMP_FH, ">>".$fileName or die "Failed opening $outputFile
file ...";
while($count le 30){
#print TEMP_FH "\n";
#print TEMP_FH " \n";
print $fileName " \n";
$count++;
}
# close(TEMP_FH);
}
Any pointer to this would be greatly appreciated..
-Wg