Sorry to be that guy, but your comment is pointless, so I had to downvote it.
While the beauty is in the eye of beholder, and you may be correct, or have high standards, praise coming from the likes of @mst should be taken seriously. People may have seen code that can stand in for sh?t, so it makes them appreciate simple niceties like good formatting, good and concise logic, etc.
BTW, I have to agree with @mst on this one; even though perl is very low on my scale of pleasantness for languages, the SQL in that code is beautifully written.