Jimmy,
    Do you know html?  In html you use "<br>" (without the quotes) to display a line 
break.
Personally, because of some reasoning's people have presented to me, I wont tell you 
to not use
-----------------------------
print $q->header("text/html");
-----------------------------
But I would HIGHLY recomend that you print the rest of your html out by your self 
(without the help
of cgi.pm).  After printing your content type header, simply print the html.  Because 
print will by
default print to STDOUT and STDOUT in this case is the clients browser, you can simply 
print your
html like this:
-----------------------------
# I'm using qq^ so that quick quote will use the ^ as my quote. I do this because its 
very very rare
# that you use a ^ in html, but very common to use quotes.
print qq^
<html>
<head>
    <title></title>
</head>
<body>
Server Name: $ENV{'SERVER_NAME'}<br>
Server Port: $ENV{'SERVER_PORT'}<br>
Server Protocol: $ENV{'SERVER_PROTOCOL'}<br>
</body>
</html>
^;
# the %ENV hash contains all of the enviroment variables
-----------------------------
You could have a seperate print statement for each line if you wanted to.

If you would like to know what all of the enviroment variables are, try this piece of 
code in your
script:
-----------------------------
foreach my $key(sort keys(%ENV)){
    # first print the variable name, then print the variable value between the quotes.
    print qq^\$ENV{'$key'} = "$ENV{$key}"<br>\n^;
    # note, you could remove the <br> if you are running it on a shell instead of a 
browser
}
-----------------------------

Regards,
David




----- Original Message -----
From: "Jimmy George" <[EMAIL PROTECTED]>
To: "cgi" <[EMAIL PROTECTED]>
Sent: Tuesday, August 13, 2002 2:19 AM
Subject: new lines


Hello World

This script is from a text book

#! /usr/bin/perl -w
#
use CGI;
use strict;
#
my $q = new CGI;
#
print $q->header("text/html"),
$q->start_html("Environment check"),
$q->server_name,
$q->server_port,
$q->server_protocol,
$q->end_html;

but how do we put \n's into it for a better display on the screen??

cheers

Jimmy

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to