Taking a wild guess from your example 'code', I'd say you're trying to run PHP code in a '.pl' file, the httpd server probably doesnt recognise that as a .pl file (no mod_perl etc installed?), and just thinks you want to download it, since it cant show it any other way..
Try saving the file as a .php file instead?
C.