I would first try:
#!/usr/bin/perl
use strict;
use warnings;
use CGI; # Assumption
use CGI::Carp qw( fatalsToBrowser );
# Rest of the code
This will translate your Perl errors and send the output to the browser.
The "Premature script headers" can sometimes be someting that is easily missed and easier to fix.
Try the following if the above snipped doesn't help much:
print "Content-type: text-html\n\n";
This will provide the output with enough headers to be processed as an HTML document.
If the content-type is not the issue, I would certainly make sure you debug with the Carp snippet. You can, naturally take out the 'use' when you're finished debugging, however it will usually point you in the right direction of the problem.
Also, make sure the file permissions are satisfactory to execute on the server. You should be safe with
chmod 755 <FILE> (
-rwxr-xr-x) if not already set this way.
Good luck!
---hA||ta----
print map{$_.' '}grep{/\w+/}@{[reverse(qw{Perl Code})]} or die while ( 'trying' );