Reply to post: Regex

Official: Perl the most hated programming language, say devs

DCFusor
Happy

Regex

I note when people are shown "ugly and unreadable" perl code, it's really mostly regular expressions...which almost every other language since - has copied/adopted too.

Regexes make my head hurt too - and I'm a big fan of perl. Wonder why you see the above so often?

Is it because perl is so otherwise useful for text processing that it's widely adopted for that use, and regexes amplify that power even more? If you grew up in C, where text was so hard to handle (and for most languages, unicode still is) - you'd just try to work around the need for much text processing.

It's not a monkeys/typewriters kind of language, to be sure. It has a much higher think to type ratio than most of the others (which I speak and use too - from ASM to C++ and a few others). So, yes, when you can get what would be 5 pages of functionality in one of today's "fanboi" languages into a short paragraph of perl, it's by-definition going to appear hard to read at a glance, probably almost as hard as those 5 page solutions. Doh.

Perl gives you enough rope to shoot yourself in the foot. Just because there's more than one way to do it, doesn't mean you have to choose the way that is the "cutest, cleverist, and most likely to promote job security since no one else can get it" way every time.

As mentioned above, I write my perl as though it was a less dense language, only taking advantage of the obscure stuff when needed, as I myself might have to understand it later. Perl lets me do that, some others don't, or force that little clever one-line bit to be 5 pages, which is itself hard to read.... To each their own, I say.

FWIW, I have a lot less trouble with cross platform perl than "write once, debug everywhere" Java, which I truly despise...

With the python fad, and it's silly/stupid use of whitespace as a language element, I'm glad to be able to incorporate it into my perl via use Inline; - and it runs faster under perl than natively, as if it doesn't have a couple of rarely used python constructs, it's *compiled* and linked to the perl program. This reveals tons of bad python hardware interfaces that use a sleep instead of a busy test...

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon