Learned Perl..
- October 27th, 2005
- Posted in Tech
- Write comment
… or at least finished the first step, Learning Perl. I made it through the whole thing without absolutely needing to peer into the back for the answers to any of the exercises. I did manage to complete an exercise or three in possibly the ugliest lines of code ever concieved – and checked the back to confirm that the easy way I didn’t think could possibly work was in fact the way I should have done it in the first place. I will definitely keep the book as a reference when I get stuck, which is bound to happen.
A lot of the scripts I’ve written were done in Python, but had very clunky and not very flexible methods for text manipulation. I doubt that is very much the language’s fault, and more my misuse of its various builtin functions. That said, I’ve found it much more efficient and flexible to rewrite several of them in Perl. When I redeploy to Ft. Benning, I’ll have to get deeper into Perl, for now I’ll keep rewriting Python scripts, and looking at other people’s Perl scripts to see what how they do what they do.
Perl is definitely easier for text parsing and manipulation than python. Especially when you get into regex.
Python is probably better suited for large projects (e.g. see plone and zope) but in terms of smaller tasks, you’ll just as many python tools as you will perl ones (python is used extensively in gnome, and in redhat/fedora install tools, perl is used widely in debian)
“Python is probably better suited for large projects” is a subtle way to say “Perl doesn’t scale”. But I could list a dozen Fortune 100 clients of ours that would disagree completely with you. Have you ever booked a ticket at ticketmaster.com? or hit citysearch.com for info? Or the Internet Movie Database? Or bought a book at Amazon.com? All Perl. All the time.
Once you have a basic understanding of Perl, pick up the “Perl Cookbook” – awesome book with lots of advanced tips. “The Perl Black Book” is quite good too.