« This is not a blog | Main | MySQL Cluster not in 5.1.12 Binaries »

November 15, 2006

A Visually Interesting Line of Code

I wrote this line of code today and thought "that looks kind of cool visually, perhaps even outside of knowing what Perl is doing":

@headers = map { $_ eq "-" ? " " : $_ } @headers;

It's trivial Perl, so I'm not going to get any awards for doing something new or unique, but it is interesting to look at. Isn't far from a palindrome.

For the non-Perl, or non-programmer folks, the line goes through a set of items and turns anything that is a "-" into a space, but leaves things that aren't a "-" alone.

Don't ask why, it's more complicated that worth explaining and would distract from the work of art, which should be allowed to stand on its own.

Posted by mike at November 15, 2006 6:05 PM