Tuesday, March 11, 2008

Learning Perl - Some advice

If you are new to a programming language, the key to learning the language is finding the right book. The first time I started learning Perl was about 7 years back. I was a seasoned Shell programmer then with little experience in C and BASIC back in school but that is all.

Disclaimer: These are strictly my own opinion. Your mileage may vary. For a language like Perl, I understand there are more than few very good books available, but again this is strictly based on my past experience, nothing else.

Fortunately I came across a really fun book at that time, "SAM's Learning Perl in 21 days". I highly recommend this book to anyone learning Perl. Ofcourse, one does not become a complete Perl programmer until he/she reads the Camel book "The Perl Programming Language" by Larry Wall, but IMHO it is for those who have reasonable expertise in Perl and strictly not for beginners. One other Perl classic is the Llama book, "Learning Perl" by Randal Schwarz, et al.

Here are some tips to learning the language,

1) Do your homework!. In "SAM's Learning Perl in 21 days", there are exercises given at the end of the chapter. Please make it a point to finish at least some, if not all, of the exercises given at the end of the chapter. The same goes true for any other book/any other language.

2) Practice makes you perfect. I was a good shell programmer then, though it proved to be little hindrance because whenever a new requirement came up, I started coding in Shell instead of Perl because I could quickly "finish" the job. At some point, I decided to convert all those shell programs into Perl and vowed to write all programs in Perl no matter how much time it takes. In my case, this proved to be the key to learning Perl.

3) Ofcourse the first few weeks/days are not going to be fun when you have to refer to manual for each line of Perl program but once you started learning, you'll be really glad you did.

4) Learn to use debugger as soon as you can! It will not only save you time and frustration, you will understand more about the language while using debugger.

5) Learn good programming practices. Once you are comfortable with the language, try advanced features such as modules that encourages good programming practices. Reuse your code whenever you can, Programming is fun when you write once and use it everywhere. A very good book on this topic is "The Pragmatic Programmer: From Journeyman to Master" by Andrew Hunt and David Thomas.

One could go on, but these are things that comes to mind. Hope you find it useful. Comments and criticisms are very welcome.

No comments: