Previous post answered your query, I guess.
Just to reiterate: For making a perl script run ion almost all servers, check 3 things:
1- permission 755 (if accessing via browser to run it)
2- The #! line
3- Do this before outputting anything: print "content-type: text/html \n\n"; #HTTP HEADER