A CGI program in Perl generally prints a header and then simply prints the HTML to STDOUT, as has been noted. A simple (untested) "Hello World!" example follows:
print h1("Hello, World!");
As noted, no explicit file handle is needed, since your script is simply printing to STDOUT.
Please do follow the advice you've been given and read up on CGI.
Note also that your script needs to be executable by the user under which your webserver runs. This generally means you need to chmod your script to 755 if running under some form of Unix.