Why Perl?
Table of Contents
- Why should I learn Perl?
- Great! Now how do I start?
- Myth Dispelling
- When is Perl the right tool for the job?
Why should I learn Perl?
For further reading see:
So why should you learn Perl? Here goes nothing:
1. Perl is Fun
Writing Perl code is very fun and rewarding:
- You can avoid dealing with many idiosyncrasies like memory allocation and freeing, passing a context variable to a function, or inconvenient syntax for complex data structures.
- The code is brief and effective.
- There is a lot of Do-What-I-Means (DWIMmeries) that make programming simpler.
- With a small amount of awareness your code can be portable across all UNIXes, and even on Windows and other platforms.
- Perl is documented extensively and you can get a lot of interactive, human answers for your questions from mailing lists, online chats and web forums.
Most serious Perl programmers love their language and love programming in it.
2. Perl is Useful
Perl has been successfully used for a lot of diverse tasks: text processing, system administration, web programming, web automation, GUI programming, games programming, code generation, bio-informatics and genealogical research, lingual and etymological research, number crunching, and testing and quality assurance.
3. Perl is Open Source
Perl is fully Free (both gratis and libre) and Open Source Software, and is usable for almost any use. It can and has been used for in-house software, web software, open source software, or open source or non-open-source commercial software (see Movable Type or Request Tracker for instance).
4. Perl can Show You the World
Perl 5 has borrowed the most important programming paradigms, and implemented them in a consistent and fun way. It is a dynamic language, that supports Object-Oriented Programming (OOP), Functional Programming (FP), Aspect-Oriented Programming, and lots of other buzzwords, while not trying to prevent you from writing quick and dirty code to get your work done.
As such, Perl is highly enlightening. If you know Perl well, you'll have no problem picking up such languages as Python, Ruby, PHP, Java, Microsoft .NET, or more obscure languages such as Scheme. In fact, Perl has proven very influential on most of these languages, to a large extent .
Perl is also a useful stepping stone for learning ANSI C and C++, and also will improve your code writing in any language.
If you understand Perl, you'll understand the world!
5. Don't re-invent the wheel! Re-use commonly used, proven code
Perl has the Comprehensive Perl Archive Network (CPAN), which is a huge collection of useful (and not-so-useful) re-usable Perl modules, under open source licences. They allow you to use them as libraries to facilitate writing your code. So instead of starting to write something yourself, do a CPAN search, or ask someone for a recommendation for a good CPAN module.
Great! Now how do I start?
See our resources page for links to pages with online resources to get you up to speed with Perl, and then become better at it.
Myth Dispelling
It's not uncommon to hear a lot of criticism about Perl. In fact, it's very common. Among the things you can hear:
- Perl code is ugly.
- Perl code is unmaintainable.
- Depending on Perl for a large project guarantees that one will fail.
- Perl does not scale to high loads or high codebases.
- Perl is slow.
- Perl is dying. (Or even that Perl is dead).
- The Perl implementation has a horrible code.
- Perl, or some parts of it (like its Object Oriented Programming support) is very weak.
- Perl is not suitable for writing web applications. (And PHP is).
- Perl code is unreadable. All Perl code is obfuscated.
- Etc.
Some of these complaints are addressed in Simon Cozens' article "Ten Perl Myths" and PerlNet's Perl Myth List. Tim Bunce focused on dispelling three large Perl Myths in a presentation he has given and made available online.
Here are some more observations:
When is Perl the right tool for the job?
We admit Perl has some problems. However, Perl 5 is still possibly the best solution for writing a large class of system administration scripts. Using the Comprehensive Perl Archive Network (CPAN), you can usually get the job done much more quickly and easily than with any other language.
Perl code can be written to be very maintainable, readable and elegant. Perl indeed sports many features and properties that make writing short programs - often one liners - easier, because this is what people use it for most of the time. However, there's nothing in Perl that prevents writing large-scale, maintainable programs. And in fact such programs have been written and are still successful.
Perl is probably not for everyone. You need to be a good programmer to write in Perl. However, code written by bad programmers in other languages can be equally as problematic as code written by bad Perl programmers.
The good news is that you can become a good Perl programmer using the resources on this site and elsewhere, and that learning Perl will improve your programming ability - not only in Perl, but in other languages as well. Are you ready to take on the challenge? Great! Then dive right in.