It needs an html header.
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello World.\n";
Or try this and then look at the source code:
#!/usr/bin/perl -w
use CGI ':standard';
print header,
start_html('My Hello World'),
h1('My Hello World'),
"Hello World",
hr,
end_html;