Perl vs. PHP
Perl is almost obsolete. This makes me sad given how much Perl I know. Not a year ago, I loved Perl. The power I could command at just a few characters! The language flexibility! I love being able to create my own custom ”dialect” of Perl for any given problem. It’s neat, and fast, and sometimes it’s even elegant.
But not really. It’s never actually elegant in the “easy to understand” sense. Plus, Perl is not an easy language to understand in general. The syntax for deeply nested references can confound the newbie Perl programmer for a very long time. And the distinction between variable types ($, @, %) seemed like a neat distinguisher… until I used PHP more.
PHP is like a really stripped down version of Perl. But it has much better OOP support. Like, tons better. I miss some things, like enforced variable declaration. And Perl’s variable scoping is more intuitive. Perl has better warnings for some things, too. But PHP’s simpler syntax proves more elegant while providing the same level of flexibility. It doesn’t have the beautiful maleability of Perl… but then again, it’s pretty maleable in its own ways. It’s not intended to be an “only one way to do things” language like Python.
One of Perl’s great strengths for me has been its nifty tricks for file I/O and common maintenance-scripting tasks. But Perl 5 has been stagnating while PHP has been growing by leaps and bounds. Most of the neat operators in Perl now have built-in function equivalents in PHP. Often they are even better than Perl’s version. Inevitably they are easier to comprehend. I’ve actually started using CLI PHP for quick one-off scripts. My uses for Perl are waning very quickly.
A year ago, when I was an active Perl hacker, I was angry about Perl 6. Perl 6 obsoletes all Perl 5 code. It’s not backwards compatible at all. “What is the point of this?” I wondered. Perl 6 has many new features, and it cleans up a lot of the syntactic awkwardness of Perl 5. But… a whole new language under the guise of a version-number upgrade?
Now, I can’t wait for Perl 6 to actually arrive. (In a viable, not-dog-slow-beta form.) It will be another year or two, I think, before the language is viable. But I would love to love Perl again.
