# 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; }