This happens when executing scripts with a different line endings pattern different to that of the system you are running. Since it seems you are running on a linux system, open your script in an editor like geany then convert line endings to unix style.
This is also encountered with apache.
Regards.
Comment on Re: bad interpreter: No such file or directory
I ran into this same issue. Thanks for the help. It worked after removing the ending characters. I wrote my pl script in Notepad++ (windows), which was causing it.