This example shows how to use the HTML methods:
$q = new CGI; print $q->blockquote( "Many years ago on the island of", $q->a({href=>"http://crete.org/"},"Crete"), "there lived a minotaur named", $q->strong("Fred."), ), $q->hr;
This results in the following HTML code (extra newlines have been added for readability):
<blockquote> Many years ago on the island of <a HREF="http://crete.org/">Crete</a> there lived a minotaur named <strong>Fred.</strong> </blockquote> <hr>
If you find the syntax for calling the HTML shortcuts awkward, you can import them into your namespace and dispense with the object syntax completely (see the next section for more details):
use CGI shortcuts; # IMPORT HTML SHORTCUTS print blockquote( "Many years ago on the island of", a({href=>"http://crete.org/"},"Crete"), "there lived a minotaur named", strong("Fred."), ), hr;