|laziness, impatience, and hubris|
The blog post is a really interesting, and it shows something important about the programming ability of the writer.
The original Perl code worked, but it was a little clumsy. A visitor called Gavin wrote, essentially, a two liner out of it, then relented and wrote a cleaner version that was 15 lines long. But there were important differences between that version and the original Perl solution.
In the original solution, contact records were only discarded near the very end of the script, when in fact they could be discarded during the input loop. This would have saved storing and sorting unwanted records, and this is true in any language.
Similarly, in the original code, each record was extracted into an array, then a reference to that array was pushed into another array -- a named variable was created each time around the loop. It would have been more efficient to wrap the statement in square brackets and make it an anonymous array, which is what Gavin's solution did. it seems obvious -- if you're creating a variable inside a small scope and using it just once, why is it there at all?
Our own blazar (I presume) produces a very readable solution that is somewhat terse but very compact. brainspun produces a nice version but again it misses the point of filtering out unwanted records in the input loop.
There's even a great shell solution which is actually what I thought about the first time I read the blog. It's a very clean way of solving the problem, and that solution *does* check the 'contact me' bit first.
Great find .. thanks!