in reply to \n won't work?!

There is another clarification that can be made. While browsers will visibly collapse multi-white-spaces, you can do a "View Source" within the browser to see the raw (unrendered) HTML. From here you will see exactly what Perl has generated. For example, this script:
#!/perl/bin/perl -w use strict; use CGI; my $q = new CGI; print $q->header(); print qq(<!--prints "Hello World" with two embedded newlines-->\n); print qq(<b>Hello\n\nWorld</b>\n);
... will render:

Hello World

in the browser. "View Source" reveals:
<!--prints "Hello World" with two embedded newlines--> <b>Hello World</b>
By judiciously using newlines and HTML comments, you can document and beautify the raw HTML source so that troubleshooting is a snap.

I hope this helps.

Where do you want *them* to go today?

Replies are listed 'Best First'.
Re: Re: \n won't work?!
by Trimbach (Curate) on Dec 30, 2002 at 04:25 UTC
    If beautifying your HTML source is your goal, don't worry about adding \n's to your CGI.pm output... just slap a
    use CGI::Pretty;
    at the top of your program and let the CGI::Pretty module automagically do it for you. Laziness is a virtue. :-)

    Gary Blackburn
    Trained Killer

Re: Re: \n won't work?!
by Anonymous Monk on Dec 29, 2002 at 19:40 UTC
    How can I learn about all the different subroutines that are included in CGI.pm?

    Thanks :)

      The best place to start would be perldoc CGI.

      --- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';