Ugghh! Printing HTML like that, while good at getting stuff
done farily quickly, is not recommended for those who wish
to learn and grow. How about this instead:
use strict;
use warnings;
use CGI qw(:standard);
print header,
start_html(
-title => 'Testing 1-2-3',
-bgcolor => '#c0c0c0',
),
ul(li[map qq|$_ => "$ENV{$_}"|,keys %ENV]),
end_html,
;
Or this:
use strict;
use warnings;
use CGI qw(header);
use HTML::Template;
my $tmpl = HTML::Template->new(filehandle => \*DATA);
$tmpl->param(env => [
map {{
key => $_,
val => $ENV{$_},
}} keys %ENV
]);
print header, $tmpl->output;
__DATA__
<html>
<head>
<title>Testing 1-2-3</title>
</head>
<body bgcolor="#c0c0c0">
<ul>
<tmpl_loop env>
<li><tmpl_var key> = "<tmpl_var name="val" escape="HTML">"
</tmpl_loop>
</ul>
</body>
</html>
And ... if you still insist on printing out HTML like you
did, then at least check out the
q and
qq operators:
# look ma, no slashes!
print qq|${var} = "${val}"\n|;
print q|<body bgcolor="#c0c0c0">\n|;
jeffa
L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.