http://qs1969.pair.com?node_id=121680


in reply to Oh my, code overload
in thread Problem with while loop

No, that's wrong. "Slurp mode" is only in effect when $/ has been localized or otherwise set to an undefined value. A filehandle READLINE in scalar context only reads a single line. seek is unnecessary, and is, in fact, probably counterproductive.

It looks to me like the OP has a tab-delimited flatfile. The first line probably lists the headers. The code grabs the field names from the first line with the first read to use as hash keys. Then it loops through the rest of the lines -- the actual data. It's not the most beautiful idiom, but it's valid code, if this is actually the poster's intent.