If you don't grok it, don't bash it.
foreach my $header in (%headers) { print WFILE "$header: $headers{$header}\r\n") }
No, no, no, back to perl beginners class with you! For one thing, that has three separate bugs in it. For another:
print WFILE "$: $headers{$}\r\n" foreach keys %headers;
I can hear all the pythoners moaning about the implicit $_, but this is in fact the idiomatic perl method of writing this common experession. Oddly enough, it's not only shorter than the only way to do it in python, but it has less punctuation than the python version, by six whole characters, and it eliminates the headers[header] thing that mashes together two too similar variables.
Also, Colin's original perl version and python version had exactly the same number of punctuation characters (17), though he claimed more for the perl version. That is not the first time I've seen such a mistake in a pro-python rant. It does not inspire confidence.
Now, while I'm speaking of python, and confidence, I was very disturbed two days ago to discover that python, for all its vaunted strict type checking, does not find the bug in this program:
did_bar=0; if bar(): did_ber=1 if did_bar: print "did_bar set"
Even pychecker will not find the bug. Maybe python programmers do not make these kinds of typos, but I do, and in "production software", the above mistake can be a beast. After I found this I threw diveintopython at the (figurative) wall, and abandoned python for the nth+1 time.