
problems with the \n escape character
Quote:
> I am using web based Perl and I am having problems with the \n escape
> character. The code is this:
> print "What do you get if you multiply 6 by 9? 42\n";
> print "We apologize for the inconvenience.";
> I get this as output:
> What do you get if you multiply 6 by 9? 42 We apologize for the
> inconvenience.
I bet this is not what you are getting as output.
I bet as Perl output you are getting
What do you get if you multiply 6 by 9?
42 We apologize for the inconvenience
in two(!) lines.
I also take the risk of guessing that you are not telling the whole story. I
bet this is a stealth CGI question. Or actually even an HTML question.
Did you hide from us that your Perl script is generating HTML code?
Did you hide from us that this HTML code is displayed in a web browser?
Did you hide from us that what you claimed to be the output of your script
is actually the rendered text you observed in the browser?
I bet it is.
And in that case you may want to think about how to code a line break in
HTML.
jue
Oh, btw: this is a very frequently asked question about HTML. Astonishingly
enough it's never asked in an HTML newsgroup.