Edit:
Wait, you're saying that changing it to mac format removes that? Interesting, I've never bothered setting any file type within nano on the mac. Now I'm going to have to go try that out.
Yep, sure does. Infuriating too. Tried concatenating the file to another file, figured std out might resolve it, but same problem. Also tried editing it and saving it in textedit, that didn't work.
Actually, saving it as a mac format will not execute on my system even if I do a perl ./perlscript while DOS file formats do. I even tried editing the file in vi.
So I opened it in textwrangler, went to edit > document options and saw that it had a windows line ending (CRLF) changed it to Unix (LF) and saved. Had to chmod it, but now it works again
Lesson learned today, I'm going to continue to ignore the option to save as either DOS or Mac formatting in nano