I found a perl script that refused to run on Max OSX. I would consistently get:
#: bad interpreter: No such file or directory
This link set me on the right direction by suggesting that there were DOS CR characters in the file rather than the *nix LF, but his suggestion didn’t work for me. Instead, I used vim to create a new file and copied the text from a text editor, and simply pasted it into vim.
A bit crude, but it worked for me
vim newfile <esc>:i <now paste> <esc> :wq