in reply to sub routine - cgi Undefined subroutine

$cgi->end_html()

Note the ">" above which you just missed.