[OS X TeX] Re: Word spacing / Comparing pdfs in Acrobat

Markus Hänchen youcontrol at hispeed.ch
Thu May 4 14:01:14 EDT 2006


There used to be a nice 'How to run a Perl script on OS X for Dummies' 
website at:
http://www.mactipscafe.com/tip015/
The website dissappeared but it still available in the Google Cache, 
without pictures however. I have pasted the content of it at the bottom 
of this message.

The missing picture labelled <helloWorld> said something like:

#! /usr/bin/perl
print "Hello World!\n";

(I hope all the code makes it through unchanged)






> If I click on latexdiff, it opens as a text file in BBEdit...
> 
> GG



How do I write and run a Perl script in Mac OS X?

Perl has been called a Swiss Army Chain Saw. It's powerful, flexible 
and probably runs on more operating systems than any other language. 
It's the key to CGI programming for the world wide web, a sys admin's 
indispensable tool and an all around great way to get some incredibly 
complicated things done in only a few lines of code. Although Perl has 
been ported to the Mac for some time, the unix underpinnings of Mac OS 
X is taking that to a whole new level.

The steps below explain how to write a simple Hello World script using 
nothing more than TextEdit and the Terminal program. Perl is already 
built in to the system so there is nothing extra to buy.

   1. Launch the TextEdit application that comes with Mac OS X. (You 
can do this by selecting Go -> Applications in the Finder and then 
double-clicking on TextEdit.)
   2. Create a new document that looks like this:

      <helloWorld>

   3. Select Format -> Make Plain Text
   4. Select File -> Save As...
   5. Give the file the name helloWorld.pl and click the Save button. 
Remember where you save it because you'll need to know the location 
later.
   6. The system will give you a message that says that the document 
named hellowWorld.pl already seems to have an extension and will ask 
you if it should append .txt anyway. Click the Don't append button.
   7. Launch the Terminal program. (You can do this by selecting Go -> 
Applications in the Finder, then double-clicking the Utilities folder 
and then double-clicking the Terminal icon.
   8. Change to the directory that contains the helloWorld.pl file that 
you just saved by typing: cd PATHOFFILE
      For example, if the file was located in your Documents folder you 
would type: cd Documents
   9. Change the permissions on the file so that it can be executed by 
typing: chmod 755 helloWorld.pl
      755 means that the owner of the file (you) can read write and 
execute it, but everyone else can only read and execute.
  10. Run your script by typing: ./helloWorld.pl
  11. You should now see "Hello World!"

Note: The two line program you just wrote is fairly straight forward, 
but does have some things in it that may look strange. The first line 
tells the computer where to find Perl to run your script. The next line 
tells it to print "Hello World!" followed by a newline characater which 
causes the prompt to go to the next line. The semi-colon tells Perl 
that it has reached the end of the command.

Note 2: If you are going to use TextEdit for Perl very often you might 
want to change a few of the preferences. You can do this by selecting 
TextEdit -> Preferences... and selecting "Plain text" for New Document 
Format and unchecking "Append .txt to plain text files". If you're 
serious about Perl though, you may want to try using a full fledged 
text editor like BBEdit. This will let you do advanced editing, 
complicated Find and Replace and provides other niceties such as color 
coded source code. BBedit is available in both a commercial and a free 
version from Bare Bones Software.


------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/




More information about the MacOSX-TeX mailing list