Richard Noel Fell wrote:
>
> Here is a subroutine that prints strings to a file. I want the routine
> to write strings to the file in the format
> Question1:factor(x^2+4*x+3)=(x+3)*(x+1).
> However, what is written to file is
> Question1:factor(x^2+4*x+3)
> =(x+3)*(x+1), that is,
> a newline befo
Try removing the newline at the end of your question with a call to chomp.
else{
for (my $i=1; $i<=$#qk+1;$i++){
chomp ($Question_hash{$qk[$i-1]});
print In1
"Question"."$i".":factor$Question_hash{$qk[$i-1]}=$Answer_hash{$ak[$i-1]}\n";
}
>Here is a subroutine that prints strings to a file.
]]
Sent: Thursday, March 28, 2002 11:26
To: [EMAIL PROTECTED]
Subject: Question about writing to file
Here is a subroutine that prints strings to a file. I want the routine
to write strings to the file in the format
Question1:factor(x^2+4*x+3)=(x+3)*(x+1).
However, what is written to file is
Question1
Here is a subroutine that prints strings to a file. I want the routine
to write strings to the file in the format
Question1:factor(x^2+4*x+3)=(x+3)*(x+1).
However, what is written to file is
Question1:factor(x^2+4*x+3)
=(x+3)*(x+1), that is,
a newline before the = sign. Is there some way of inhib