views:

1328

answers:

21

I decided to learn Perl after realizing that most of my bash scripts were getting rather unwieldy in their current form and would become a maintenance nightmare if I continued down that path. A friend showed me a couple of examples using regular expressions and in-built modules in Perl and I was hooked instantly. To that effect I borrowed a copy of "Learning Perl" (great) and "Beginning Perl" (not quite), registered on PerlMonks and downloaded a copy of the perldoc which has become a bible of sorts for me currently.

As of this moment I fell comfortable with the basics, though topics such as building modules, OOP and to an extent, references, still continue to elude me. The material in the above mentioned books is rather sparse for these topics and since my interest now goes beyond just converting shell scripts I would like to delve further into the language. Any suggestions on which books / materials I should peruse? Are there any projects out there in the wild that would help my learning and give me a better grasp of larger programs written in Perl?

Please note that my basic day to day tasks involve system administration but I also like to devote time to open-source projects in any capacity whatsoever. All suggestions, links and tips are welcome. My next read is going to be Intermediate Perl but I am always open to other suggestions.

+11  A: 

From the same series, I have Perl Cookbook, Programming Perl and Advanced Perl Programming. As well as being very handy, they look quite nice side-by-side on my bookshelf.

I'd never heard of Intermediate Perl, I went straight from "Programming Perl" to "Advanced Perl Programming" to Python :-)

Perl Cookbook

Programming Perl

Advanced Perl Programming


Adding Mastering Perl at the behest of brian d foy, who as far as Perl is concerned, wrote the book on the subject (literally):

Mastering Perl

paxdiablo
'Programming Perl' is my primary dead tree source of Perl info - I bought it around 6 years ago and have consulted it within the last week.
Cebjyre
Please don't read the Perl Cookbook. It is horrifyingly outdated, and will set your Perl knowledge back at least a decade.
jrockway
"Intermediate Perl" was previously known as "Perl Objects, References and Modules". (aka PORM)
Sean McMillan
"Advanced Perl Programming" aka "The Retarded Bear" is wildly out of date and wasn't that good to begin with. The Cookbook is pretty out of date, too. Proceed instead to "Intermediate Perl", "Programming Perl" and perldoc.perl.org.
Schwern
Mastering Perl is the successor to Advanced Perl Programming. We wrote that to be what Advanced Perl Programming 2nd Edition should have been.
brian d foy
+1  A: 

Whenever I want to learn a new language, I read up with some beginners books as you mentioned, but what helps me most is applying what I know to a task that I need done. In otherwords, instead of writing your next bash script use Perl.

Not quite as often I've taken scripts that I had written in one language and rewrote them in the new language.

I do this, because I've learned in the past, writing "Hello, world!" applications or apps that just demo functions, don't really exercise your knowledge of the language.

Rob Haupt
+11  A: 

Reading the Perl Cookbook is a great way to see it tackle real-life scenarios.
For system administration, there is the Perl for System Administration which is quite useful.

For learning about references and complex data structures, the perlref tutorial is pretty good.

Renaud Bompuis
+3  A: 

Although it may not be quite the answer you're looking for, something you could consider is sidestepping into another language where it might be easier to pick up some of the concepts you're having trouble with. Java is a great way to learn the concepts of object-oriented programming, Python might be good for modules, and studying pointers in C might help prepare you for understanding references in Perl (well, after you study pointers, references might be a piece of cake!). The disadvantage is, of course, that all these things will take time away from your Perl studies and quite possibly break your concentration, and for that reason I'd hesitate to recommend jumping ship to another language at this point. I'm sure other people will offer other, more Perl-centric suggestions. But it is at least something to consider - especially later on, once you're feeling more comfortable with your first (second? ...) language.

David Zaslavsky
If you want to learn OO, don't go to Java. Try something like Smalltalk where almost everything is an object, not just some things. :)
brian d foy
Or ruby, with syntax not too different from Perl's and an object system pulled from Smalltalk.
justkt
+5  A: 

Mastering Regular Expressions

mastering regular expression cover o'reilly

J.F. Sebastian
+9  A: 

Higher-Order Perl

J.F. Sebastian
HOP is a fantastic, mind-bending book, but it should come *years* after reading Learning Perl.
Michael Carman
+5  A: 
Bill the Lizard
+5  A: 

There is of course the next step. Intermediate Perl. This book will teach you some of the the things you mentioned as eluding you.

J.J.
+3  A: 

Hi in case you're interested in learning Perl to do web apps. Then Catalyst is for you.

Or you're a speed freak and love to tweak stuff around, then try the algorithm book.

melaos
Catalyst is actually a good framework to apply intermediate to advanced programming techniques as well.
singingfish
+1  A: 

I'll second the recommendations for Mastering Regular Expressions and Programming Perl. But I would also recommend returning to the basics if you really want to become comfortable with Perl. Start with getting more acquainted with the AWK Programming Language and Sed. So much of Perl mastery comes from Sed and AWK.

Other than that, I'll bump the recommendation on learning Python as well. I have pretty much replaced my Perl usage with shell script for basic things and Python for anything even remotely complex.

D.Shawley
A: 

I moved from Perl to Ruby a long time back. It's a lot easier for me to code i.e. Ruby thinks the way I think - might not work for you.

Whenever I want to do Linux admin tasks, I am able to write those scripts in Ruby very quickly. Also wrote a basic DPF in some 5 hrs with Ruby + GTK + GStreamer.

Haven't worked extensively with Perl in the last 6 years, so again today's Perl might be completely different. Also, Perl has the largest user/script/knowledge base of all scripting languages.

Ranjeet
Not sure why negative points were left, the original poster has clearly mentioned "I am always open to other suggestions"
Ranjeet
"I am always open to other suggestions" implied that I am willing to follow other paths to improve my "Perl" knowledge. I am not asking for suggestions on which language to move onto after Perl, but rather what do I do to improve my understanding of Perl.
muteW
Why did this post get any upvotes?
Brad Gilbert
+8  A: 

I learnt my Perl from Programming Perl. This book is regarded as one of the computing classics so I recommend having it even if you have already dipped you toe into Perl with Learning Perl.

Despite some suggestions here.... moving to Python or Ruby isn't going to magically make u write better programs ;-(    However reading Perl Best Practices probably will ;-)

After PBP I highly recommend Advanced Perl Programming & Higher-Order Perl

Oh and when it comes to OOP then look no further than Moose. There is even a Moose Manual to peruse.

/I3az/

draegtun
+11  A: 
brian d foy
The problem with reading the perldoc manual is that things can seem quite fragmented when you are not searching for something in particular and just want to learn the nitty-grittys of the language.
muteW
I think you must not have seen the documentation recently. There are lots of sections that pull together task-oriented comments.
brian d foy
+3  A: 

Well, Intermediate Perl is intended to be as the sequel to "Learning Perl" and Mastering Perl as the third book in the series, so you may wish to try them. I personally haven't read any of them.

I can personally recommend Programming Perl (a.k.a "The Camel Book") but I now feel it may encourage many bad practices. Perl Best Practices is also a recommended read after you know enough Perl just to enlighten one about proper daily decisions in your coding. I and other people who've read the book consciously deviate from its recommendations, but they still should be considered.

You may also wish to read the material on perldoc.perl.org especially the tutorials, though I am mostly using them only for reference.

Finally, I'd like to pitch my Perl for Newbies series of presentations, which aims to teach a horizontal subset of Perl using many examples. There is still a lot of material I'd like to cover there, but I have other priorities. And I still may encourage some relatively old practices. Still, it is there for your perusal and is licensed under the CC-Public-Domain.

Shlomi Fish
Do you mean "inhibit"? It sounds like "suggest", "impart", "advocate" may be closer to your meaning. PP is a great read and reread. But it does show its age. PBP is a very good read, and should definitely follow LP.
daotoad
daotoad: where do you see "inhibit" or whatever?
Shlomi Fish
@shlomif: In your answer before the edit.
sundar
+2  A: 

I would highly recommend heading over to Perl's documentation online and browse through the tutorials section.

Particular favorites include the following:

You should be able to get these on any machine that has has perl as well (via perldoc perlreftut or the like), but it's nice to be able to get them with hyperlinks and with the option of saving them as pdfs. After that, I would browse through the FAQ, maybe a section a day. Not all of them will matter to you (or not right away), but you can learn a ton from them.

Telemachus
+2  A: 

I Highly, Highly recommend Perl Best Practices. There's a lot of good information in there about style and introduces you to a handful of common tools.

However, there's a lot modules that are not really best practices any more. Take a look at this commentary on the book for module recommendations.

Robert P
+1 for the link
Martin
+2  A: 

While not a book, I'd also check out Moose, an object oriented package for perl 5. If you ever plan on doing OO in Perl, you can't really do much better.

Robert P
A: 

How about moving on to Python? Perl is a great language for powerful one-off scripts and text processing, but Python has great support for server processes and backend developement. In addition, once you get used to Python's interesting "scoping via indentation" you'll fall in love with the simple and clean look of the code, especially as compared to Perl...

slacy
Honestly. How is learning Python going to help someone learn Perl? If you had said, "How about learning another language as well?" it would be a somewhat appropriate answer. But the other language ought to be something completely different. Learning a bit of Lisp helped me be better at Perl.
Jon Ericson
I switched from Perl to Python and haven't looked back.
Casey
When Python has weak typing and multiline lambdas I might consider it.
Chas. Owens
When Python is referred to as a **Swiss Army Chainsaw**, I might consider it.
Brad Gilbert
A: 

One intermediate book I found useful is

"Effective Perl Programming: 60 Methods and Rules for Scripting Better Programs"

By Joseph Hall and Randal Schwartz.

It's quite a short book, but clear and to the point.

Martin
There's anew edition of this coming out in Spring 2010. :)
brian d foy
New edition is out, and it's a *great* book.
Christopher Cashell
A: 

Writing Obfuscated Perl.

+1  A: 

I would highly recommend checking out Effective Perl Programming: Ways to Write Better, More Idiomatic Perl (2nd Edition). It won't teach you to program in Perl, but it will teach you to be a better Perl Programmer. It's like having an experienced mentor on hand to give you a ton of tips, tricks, idioms, and best practices, all in an easy to read book. One of the best Perl books I've read.

Christopher Cashell