In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Yitzchak Scott-Thoennes) wrote: >Ronald J Kimball <[EMAIL PROTECTED]> wrote: >>Here's my current solution, at 64: >> >>-pl $_=join':',grep defined,/"([^"]*)"(?![^\s#])|([^\s#]+)|#.*/g >> >>Originally I had $_.0 instead of defined, but I realized that that skips >>empty fields, i.e. "". Is there a shorter way to test for defined? > >Not that I can think of. > >>BTW, (?=\s|#|$) is shorter than (?=[\s#]|$). > >So is (?![^\s#]). That gets me to 62: > >-pl s/\s*("([^"]*)"(?![^\s#])|([^\s#]+))\s*(#.*)?/$2$3:/g,chop
Which fails for lines with more than one character but no fields. With no easy fix. I think you've got the winner, Ronald.