in reply to Re: golf anyone? (taking first field)
in thread golf anyone? (taking first field)

Very impressive!

It's amazing how people make their own additional constraints and then blame someone for not writing a clear specification.

Your solution

map/(^\s*[^:]*[^:\s])/,@list
Is beautifully clear and simple, not just short because of fancy tricks. Read all the leading whitespace, read up to the first : or to the end, finally back off any whitespace. (actually, will read over consecutive :'s, not the first. But it's the first =occurance=.)

In general, the x*y regex idiom, where y is a union of x and w, will take internal w but not trailing w. This triggers backtracking to literally "back off" if it happened to end in w.

Furthermore, it works with only the most common regex features, not using rare backslash chars or extensions. It can be grocked by anyone with a little regex experience.

The fact that the blank lines and blank-after-truncating lines are purged without special case logic means that the algorithm to "find the interesting part" matches neatly what the defining characteristic of that interesting part is. The desired behavior of blanks and empty lines is a natural concequence of that fundimental idea, not arbitrary rules designed to make it harder (like a putt-putt course's windmill?).

Well done. I think you hit the sweet spot on that one.

—John