At 5:53 pm +0100 21/1/04, manu chao wrote:
Hi, I just wanted to get started by following the tutorial at http://www.mactipscafe.com/tip015/ but I get the following error: 'Exec format error. Binary file not executable.'
I did the chmod step as you can see below
[xxxxxxxx:~/Desktop] xxxxxx% chmod 755 helloWorld.pl [xxxxxxxx:~/Desktop] xxxxxx% ./helloWorld.pl ./helloWorld.pl: Exec format error. Binary file not executable.
Any help would be really appreciated.
1. Your file must have the shebang #!/usr/bin/perl to be executable 2. The shebang must be followed by a line feed, NOT a carriage return 3. The whole file will preferably be delimited with line feeds 4. It is not necessary to have either the shebang or exec permissions to run the script using $ perl temp.pl 5. To run it with ./temp.pl, the file must be executable 6. If you create the file in a text editor, make sure it is saved as plain text and with line feeds and not carriage returns 7. The only place where a line feed is absolutely de rigueur is immediately after the shebang.
Here's something you can try step by step in the Terminal:
xx:~ jd$ cd /tmp # go to the tmp directory xx:/tmp jd$ # write a test file ... xx:/tmp jd$ echo '#!/usr/bin/perl
print "Hello\n" ' > temp.pl
xx:/tmp jd$ cat temp.pl # check the result by reading the file... #!/usr/bin/perl print "Hello\n"
xx:/tmp jd$ perl temp.pl # Have perl run the script Hello xx:/tmp jd$ ./temp.pl # Try running the script as executable -bash: ./temp.pl: Permission denied xx:/tmp jd$ chmod +x temp.pl # Make it executable xx:/tmp jd$ ./temp.pl # Try again Hello xx:/tmp jd$