in reply to sub routine - cgi Undefined subroutine

Your missing the '>' sign in your end_html() call.
$cgi->end_html();
Wonko :-)