Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to generate html file by perl

Status
Not open for further replies.

michael12

Programmer
Sep 26, 2002
25
0
0
US
How can I create a html file(now just display on browser) by perl?
Now I can view this html page by:

print load_template("abc.html", {links => $link});


I want to generate a html file which don't have to be called by perl.

 
use this:

my @htmlCode = qq{
<html>
<body>
This is my html page!<br>
</body>
</html>
};

open(FILE,&quot;somefile.html&quot;);
print FILE @htmlCode;
close(FILE);

hope this helps!
 
Hi ,

The best way to generate HTML content from PERL is
to use the CGI module.
Here's a sample code:

//first.cgi

use CGI;

my $cgi = new CGI;

print $cgi->header; #header info

print $cgi->start_html(-TITLE=>&quot;My First HTML thru PERL&quot;);
#prints<HTML>,<BODY> ,<TITLE> tags.

print $cgi->p(&quot;Hello and welcome to CGI&quot;);
#This is to print text

print $cgi->end_html;#end of HTML,prints </BODY></HTML>,


Save this file as a .cgi file on your webserver to view the html content.Your CGI script will be automatically excuted
(Need not be called from any program).
Check out..
$man CGI
if you have PERL installed on your UNIX or other
CGI tutorials on the internet.( to name a few)

regards,
VGG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top