.pl extension on Mac OS X

chirp84

Registered
I can't run a perl program after saving it as an .rtf using TextEditor then changing file extension to .pl.

Very frustrating. I am switching from Windows Strawberry Perl to Mac OS X Perl v5.12.3.

The terminal feeds back:

Backslash found where operator expected at hello.pl line 1, near "rtf1\"
Backslash found where operator expected at hello.pl line 1, near "ansi\"
Backslash found where operator expected at hello.pl line 1, near "ansicpg1252\"
Backslash found where operator expected at hello.pl line 1, near "cocoartf1138\" ..... and so on

Am I renaming the file incorrectly?
 
No, you're renaming the file just fine.

The problem stems from saving the file in "Rich Text" format.

Save the file as plaintext. The terminal will not understand a script saved as Rich Text/RTF. If you're using TextEdit that shipped with the Mac, then look in the menu for an item called "Convert to plain text". You'll know you did this right when you go to save the file and the extension is ".txt" instead of ".rtf".
 
Back
Top