View Full Version : Python, Perl, something else?

Apr 22, 2011, 12:51 PM
I'm pretty good programming in PHP and Javascript, but now I need something that allows me to create simple desktop apps. Mostly it will be for automation scripts, too much for Apple Script, but not complex enough to jump into Cocoa and Objective-C. Examples: Manipulating text files (sorting, dupe line checking, adding/cutting parts, splitting/combining files etc.), uploading a file to several different FTP servers, sending POST requests to a server.

I often hear Pearl and Python mentioned and I believe they are pre-installed on the Mac, but I don't know much about them. What's the main difference? Which one (or something else?) would be best suited for these tasks? Which one is easier to learn?

Bonus: What's a good site to learn for someone who has general programming knowledge, but is a total noob with those languages?

Apr 22, 2011, 03:18 PM
I am not fluent in Perl but I do use Python at my work. I am mainly a C++ developer. I find Python easy to use and quite powerful for the things you listed. There are many 3rd party libraries that will help with most things you need to do. A SSH client called Paramiko was VERY helpful to me for logging into servers and transferring files and running commands. This site may help get you started with Python and Paramiko's SSH library.


As for the file and string manipulations you listed, I find just doing a google search is helpful enough.

Just make sure you get a Python debugger if you go that way. I use Eclipse with Pydev. I am sure others may suggest a better debugger. It is adequate for my needs.

Apr 22, 2011, 03:43 PM
Given that you already know PHP and javascript, you just need help with the Python syntax. I looked up removing duplicate lines in a file on google:


I got this hit:


Or this:


Try that and start building up your scripts from there.

Apr 22, 2011, 05:29 PM
I would use Python as there is a Cocoa bridge for Python. Though untimately you will need an understanding of Obj-C and Cocoa to make decent Mac OSX apps. Even if you are coding in Python.

Apr 22, 2011, 06:26 PM
I'm a great fan of Ruby myself. Check out MacRuby (http://www.macruby.org/) which runs directly on top of the Objective-C runtime, not via a bridge. Check out Aimonetti, Mark (2011?) MacRuby : the definitive guide, O'Reilly (http://oreilly.com/catalog/0636920000723/). It's still in early release, due for final release in July.

Bill McEnaney
Apr 23, 2011, 11:37 PM
I'd use Python.

Apr 24, 2011, 07:48 AM
FWIW Oreilly's Learning Python e-book http://oreilly.com/catalog/9780596158071/ is available for 50% off through the rest of the weekend. http://oreilly.com/


Apr 24, 2011, 03:58 PM
Thanks for the replies! I'm a little surprised there's not one speaking up for Perl, but yeah, did some more research on my own and found this
The Cocoa bridges/runtime are not a concern to me as I don't want "to make decent Mac OSX apps" with GUI and everything, just some command line tools for my own use. But the examples at that link pushed me over to go with Python. To put together quick automation scripts every now and then, I don't want to deal with a steep learning curve. The Perl examples there looked just too cryptic to me.

Apr 24, 2011, 05:54 PM
The Perl examples there looked just too cryptic to me.

I think you've hit on one major reason why some of what might have been done done in perl ~15 years ago is likely to be done in python or maybe ruby today.

Perl is extremely powerful, but you can do a lot of what you say you want with chains of other "single function" tools like awk, grep, sort, uniq, ....