2006-04-07

Perl fondly

I've read a many complaints about how Ruby took on too many Perl-isms. Actually, that's probably one of the bigger criticisms, and I completely disagree. In fact, I think Ruby is missing a few Perl-isms.

Some things about Perl that keep me coming back or I just appreciate.
  • THE BEST regex syntax, which basically was inherited from awk/sed and the like. I am puzzled that while Ruby smartly has "=~" they didn't include the substitution syntax form "s/.../.../g" which is so common, ingrained, and best of all, compact. WHY WHY WHY?!! I mean, Ruby can still keep the sub() and gsub() (so as not to munge in-place). This is why I still use Perl for all of my command-line hacks [perl -pe] instead of Ruby. BTW, Python's regexps suck balls.
  • Variables are easily identifiable because ALL variables begin with a $ or @ or %. Since Ruby is OO and has good data structures, only one symbol would be needed, say the $ (which means global in Ruby though). When I first learned Perl, the constantly having to type $, I admit, was kind of annoying. But I learned to appreciate it.
  • Because of the regex syntax and the "everything is a string" paradigm, it really is nice and convenient to quickly manipulate strings which is what I spend a good chunk of the time doing at work.
But generally, I've outgrown Perl for most of my scripting tasks; it's just not practical or convenient since the data structures are rather weak. I wish others in my group would follow suit.

No comments: