# Good script language to learn?



## havic (Apr 6, 2004)

I've decided to learn a scripting language now, and I'm trying to decide what is the best.

I'm not interested in AppleScript, I was looking at Perl.  I hear there are some better ones around than perl though, so I want a few extra opinions first.

Fire away


----------



## symphonix (Apr 7, 2004)

The two you mention are vastly different languages.

AppleScript has the advantage of being able to tie into many desktop programs and Apple specific functions. It's also a little on the complicated side but at least the code is very easy to read. It's the only option if you want to call specific info to or from desktop applications, such as iChat or PhotoShop.

Perl is a scripting language that is great for text and data handling and is used for CGI scripts enabling interactive web content. It's the handiest one if you want to whip up a web interface to something. The code is compact, harder to read, but very good fun to program in once you get the hang of it.

Bash and tcsh are great shell-scripting languages for running commands as you would in the Terminal.app. Bash is considered a great introduction to programming as it is simple, linear and reliable. It is unforgiving of Syntax errors though.

You can tie these together. For instance, an AppleScript can use "do script" to call a bash or tcsh script, while a bash or tcsh script might use the osascript command to run an AppleScript. Perl, as well, can call bash, tcsh or AppleScript with a little tweaking, and the "perl" command makes it easy to call a perl script from bash or tcsh.

It essentially comes down to what you want to achieve. If you want a web-page that when you open it shows what iTunes song you have currently playing, you'll need to use Perl to create the page content, and call an AppleScript to retrieve the actual song information from iTunes. On the other hand if you only want to use a few Unix commands and so on, a shell language is the easiest. For learning something just to get the hang of basic programming, I'd recommend bash.


----------



## havic (Apr 7, 2004)

I already program in C and Obj-C and can program in BASIC if called upon, so it isn't going to be learnt as an introduction to programming.

I said I wasn't interested in AppleScript because it is a OS dependant language.  I was looking for something like Perl because it will run on most platforms (I think?).
Perl sounds like a nice option anyway, because of its web capabilities.

It would be nice to have the ability to tie into applications natively without having to call a separate applescript, but it isn't really much of a problem to be honest.  I haven't found many programs to have particulary good script support regardless.

It sounds like Perl is the way to go, so I might have a bit of a look at the language tonight.


----------



## Macwind (Apr 7, 2004)

JavaScript?


----------



## naodx (Apr 7, 2004)

Perl is pretty slick, not only can you write scripts for system level things, you can also use it for web scripting..

My vote is for Perl! 

http://www.perl.com/

http://www.perldoc.com/

http://www.perlmonks.com/

http://perl.oreilly.com/


----------



## havic (Apr 7, 2004)

Perl it is then.

I don't really want to learn Javascript, as it is only for web stuff.  Doesn't work for system level scripts AFAIK.

Thanks for the help guys, and for the links naodx.

On a side note, the reason I asked is because one of my mates told me that there is a new language coming in; sort of like Perl only better.  Anyone have any idea what he might have been talking about?


----------



## anarchie (Apr 7, 2004)

Did nobody mention python?  It's a refreshing break from languages that have you abuse curly braces, and its array syntax is just sweet, sweet candy.


----------



## themacnut (Apr 9, 2004)

Another good language to look into is php:

http://www.php.net
http://www.php.org/forums
http://php.resourceindex.com

Good for most of the same things Perl and Python are, and you may find it's syntax more to your liking.


----------



## drustar (Apr 9, 2004)

If you are to learn php, asp, javascript; a nice addition would be actionscripting.


----------



## zrosnbrick (Apr 13, 2004)

I use perl to do my computer program, I am 14 years old and it took me about a month to learn, so it is very quick and easy to master the basics. There are also a lot of good resources to find answers to your questions about perl. Perlfunc.org is a good resource. Another way to build your skills is to visit the Euler Project section of mathschallenge.net, it has problems, some simple, that use computer programs to solve. Good luck!


----------



## LordCoven (Apr 25, 2004)

If you want to get into scripting, I'd recommend considering learning all of the following: sed, awk, bash, perl / python. Reason being: I've listed them (if memory serves) from least complex to most complex, whereby perl and python are on a par, really. If you're going to be working with *nix systems, or even Windows with Cygwin on, then knowledge of those scripting languages will really really come in handy. Its a bit overkill using awk where sed will do, bash where awk will do and python / perl where bash will do - but they all have their place and purpose - and if you can already program, then picking them up really won't be difficult.
The reason I recommend looking at both Perl and Python is that they are about as powerful as each other, but significantly different in their syntax and 'feel'. You'll won't to learn one or the other (or Ruby, perhaps, but I've no experience with that so can't really comment) because it will definitely come in handy, but you'll have to decide which one's for you based on your own taste and preferences.
Ramble over 
C


----------



## Arden (Apr 26, 2004)

PHP is a great language, but it's pretty tough to implement outside of the web scripting arena.  If you want something more system-level, Perl or Python would be a better choice.

What exactly is this language your mates suggested?  I mean, I've read about a language called D that is supposed to be like C/C++ but better, but honestly, who actually programs in D?


----------



## LordCoven (Apr 26, 2004)

I apologies for my horrendous typo: 'You'll won't to learn ...'!! It was far too early in the morning (for my liking) for my mind to be functioning properly 
Cheers,
C


----------

