I'm just finishing up a Perl version. Very similar. Though it writes bad KML at first (just half of the xml tag) and waits for you to prompt. That way you can force the error message (and select ignore) right off the bat.
I scanned most of Massachusetts in 72 minutes
I'll post it up shortly, probably doesn't deal with crossing very well (yet), but it's on the TODO.