Did you access it via a webserver? Did your location say "http://127.0.0.1/myscript.pl" or "/usr/local/httpd/myscript.pl"? The latter form will access it via the file system and not run the script.
If you accessed it via a webserver, does the webserver know what to do with it? In apache, this means that your httpd.conf needs to have a Script-handler set (If you are using a script directory, such as /cgi-bin/), and the directory the file is in needs to have ExecCGI set. See the Apache docs. (The httpd.conf file should have lots of example text in it if it is a recent version.) httpd.conf will usually be located in one of:
/etc/httpd.conf
/etc/httpd/httpd.conf
/home/httpd/conf/httpd.conf (Why RedHat insists on using "/home" I'll never know)