If you have perl on a local machine you can run the code from a command line and read the errors... sometimes as simple as a missing curly bracket or semi-colon.
Otherwise, see if your host has a "Check Perl Scripts" utility you can use to debug online.
1) make sure you upload script using ASCII transfer mode - if you use binary then Unix system will choke and die on Windows style of end of lines.
2) make sure you have turned buffering off, use this: $¦ = 1;
3) of course you need to output at least some headers! Here is bare minimum:
print "Content-type: text/html\n\r\n\r";