In my experience, the documentation for the CGI.pm module is enough to fix code to a readible level.
#!/usr/local/bin/perl -w
use strict;
use CGI;
my $q = new CGI;
print $q->header(-type=>'text/html'),
$q->start_html(-title=>'CGI.pm is Great'),
$q->h1('CGI is GREAT'),
$q->hr,
$q->end_html;