Perl-related stuff and beyond (but not much)

Saturday, May 09, 2009

Some say Perl is ugly

Some say Perl is ugly because is uses a lot of non-alphabetical characters in its syntax. Well, I think that approach is stupid. In effect it's the same as saying that russian is ugly because it's written in cyrillic. What kind of argument is that? What about all those people who speak russian? Are they not-really-smart because they write it in cyrillic? I don't understand it. I never will. It would be okay if Perl was ugly because you have to write the for loop in some uber-complex-assembler style. Ok, that's ugly and non-trivial. On the other hand, people that object to the sigils use funny nomenclature in their programs; combination of hungarian notation and camelCase. I cannot read it. It's ugly. (Sarcasm mode turned on.)


rjbond3rd said...

Perl puts power into a rich set of operators. Java and languages like it have a very small set of operators, and you have to delve into the libraries to do the most basic operations like regexes.

I just don't want to do that much typing. I can't believe how much code I have to type simply to open a text file in Java, iterate over all the lines, do a search-and-replace, and then save the file.

It's crazy. Perl can do that in a handful of lines because of its powerful operators. Yay!

Humorous observation: I once asked a Perl guru how many special variables Perl had (the ones like $!, $@, $| etc.) And he said, "One for every punctuation key on the keyboard." I thought that was funny. Of course, some of those operators are now deprecated.

One thing that Perl newbies often miss is how much thought went into choosing the special operators and sigils. There is an interesting story and mnemonic strategy behind most, perhaps all, of them.

For example, the sigil @ is supposed to remind one of the "a" in array, the sigil % reminds us of key-value pairs, the special variable $| (output buffering) uses the pipe character to remind us it's about output, etc.

draegtun said...

These mnemonics guides....

%ash quite well methinks!


Chris said...

Hi, I have a couple jobs that I would like to advertise on your site or via an email list to inform your readers about Perl programming jobs. Please get back to me as soon as you get a chance.

Look forward to hearing from you.