I've decided to dive into Perl, and I'm starting with Learning Perl by Randal Schwartz and Tom Phoenix. As someone who's mainly worked with more conventional languages, Perl's philosophy and governance model are fascinating.
The Benevolent Dictator
One of the first things you learn about Perl is that it's not governed by committee or corporation—it has Larry Wall, its creator, who serves as the "Benevolent Dictator for Life." The community has even codified this into the "2 Rules":
"Wall continues to oversee further development of Perl and serves as the Benevolent Dictator for Life of the Perl project. His role in Perl is best conveyed by the so-called 2 Rules, taken from the official Perl documentation:
- Larry is always by definition right about how Perl should behave. This means he has final veto power on the core functionality.
- Larry is allowed to change his mind about any matter at a later date, regardless of whether he previously invoked Rule 1.
Got that? Larry is always right, even when he was wrong."
At first this seems dictatorial, but there's something refreshing about it. Clear vision and decision-making, rather than design-by-committee paralysis.
Open Source vs. Corporate Control
The book makes a brilliant satirical point about the difference between open source languages and corporate-controlled ones. They present a hypothetical scenario:
Imagine that instead of using Perl, you licensed a programming language called Forehead from a giant, powerful corporation owned by a zillionaire with a bad haircut. (This is all hypothetical. Everyone knows there's no such programming language as Forehead….). Now think of what you can do when you find a bug in Forehead. First, you can report it; Second, you can hope – that they fix the bug, hope that they fix it soon, hope that they won't charge too much for the new version. You can hope the new version doesn't add new features with new bugs, and hope that the giant company doesn't get broken up in an anti-trust lawsuit.
The "Forehead" jab is pretty obvious, and it highlights why Perl's open development model matters. With Perl, if there's a bug, the community can fix it. No licensing fees, no waiting for corporate release cycles, no vendor lock-in.
First Impressions
I'm already noticing Perl's philosophy of "There's More Than One Way To Do It" (TMTOWTDI) in the syntax. Here's a simple example that reads input and prints it:
while (<>) {
print; # same as print "$_";
}
What's interesting here is how Perl makes common tasks concise. The <> operator reads from input (files or STDIN), and print without arguments automatically prints $_, the default variable. It's terse, but once you understand the conventions, it's remarkably expressive.
Next Steps
I'm working through the exercises in Learning Perl and will post more about my experiences with the language. The syntax is definitely different from what I'm used to, but the philosophy behind it is compelling.
I'll keep you updated on my progress as I explore this "Programming Republic." Last modified: 2010-03-11 WordPress ID: 548