CGI notwithstanding, the error is in your here-doc syntax. In Perl, here-docs must be created in the following ways:
print << "SPACE_ALLOWED_WHEN_THIS_TEXT_IS_QUOTED";
This is documented in perlop
: "There must be no space between the '<<' and the identifier, unless the identifier is quoted. (If you put a space it will be treated as a null identifier, which is valid, and matches the first empty line.)"