#!/usr/bin/perl use strict; use warnings; # CGI headers (note two newlines, one for a blank line) print "Content-type: text/html\n\n"; # Now anything else you do is HTML ... print "\n"; print "
\n"; print "

Hello world!

\n"; print "
\n"; print "\n"; #### # CGI headers (note two newlines, one for a blank line) print "Content-type: text/html\n\n"; # Another way to format HTML my $text = qq{ : :
:

Hello world! :

: }; output($text); # Subroutines sub output { my ($text) = @_; # Reformat the HTML text (remove leading colons ':') $text =~ s/(^\s+:)|((?<=\n)\s+:)|(\s+$)//g; # And output it print $text; }