in reply to Survey file parsing

It looks like the variant version starts each header line with a space. Is it possible for the data to start with a space? If not:

  if (/^H/ or /^ /) {

Alternately you could look for the "key : value" format that all the header lines seem to have:

  if (/^[^:]+\s+: \S+/) {

But you'll have to be sure that your data lines can never match that format.

-sam