in reply to How can i run perl on osx

I just tried that on my own macosx (10.4.5 with perl 5.8.6), and the apache server had no problem with it at all (I got "Hello, Word" in the browser).

I've never seen "Exec format error" before, though there do seem to be a number of references you can find if you google that string. Does /usr/bin/perl work for you from the command line? (And does that script work from the command line, if you just type /Library/WebServer/CGI-Executables/first.pl at the shell prompt?) Based on the few google hits I've looked at for this error message, I would expect the command line usage to fail just like the web-server usage.

Are you sure that the shebang line ends with just a line-feed (LF, 0x0a), rather than anything involveing a carriage-return (CR, 0x0d)? (Check it using the "od" command; also try changing it to  #!/usr/bin/perl -T)

I doubt that httpd.config has anything to do with it (I don't think anyone here wants to review that), but you should probably check it over on your own.