sloppycode.net
HTML output/priting in Perl
An alternative way of printing HTML in Perl.
Home
›
Code snippets
›
Perl (CGI)
›
HTML output/priting in Perl
Here is a useful example of how to print multiple lines of HTML in Perl, without using hundreds of lines of print "html output here". It also shows you how to redirect all errors to browser, make debugging a lot simpler
#!/usr/bin/perl # This line forces all errors to be shown on the browser use CGI::Carp qw(fatalsToBrowser); # Using << to delimit html (it can be followed by any name) print "Content-type: text/html\n\n"; print <<OUTPUT; <html> <head> <title>hi world</title> </head> <body> Hello this is cgi printed HTML </body> </html> OUTPUT
{Name}
Says:
{Date}
{Text}
› Home
› C#
› Snippets
› Articles
› Tools
› Taglines
› ASP
› Dictionary Object
› FSO
› Unix cheat sheet
› Gaming
› CSS
› Yak
› Umbraco
› About
› Contact
› Privacy
› Projects
› Search
› Sitemap
Buy on Amazon
Buy on Amazon
Buy on Amazon
Buy on Amazon