Thursday, June 11, 2009

Three-minute hate

I think I may finally have gotten the hang of Perl's regular expressions, at least to the point that I'm able to bang out some basic logreaders pretty quickly. We still hates them, precious, but I have to admit that it was the right approach: I was sorely tempted to use some manner of incremental tokenizing to grab chunks of the log piece by piece, and use nested if statements to deal with different formats, and... yeah, it sounds even worse when I write it out like that.

One of the big conceptual problems I have with regular expressions in general is that they nearly always result in write-only code. Sure, it can be commented, but in practice nobody ever does. Worse, once you get reasonably good with them, all of a sudden you're the go-to guy for regex (This is not as bad as, say, database expertise, but still) Yeesh.

No comments:

Post a Comment