#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11145686 use warnings; open my $fh, '<', \< }; # read through "fieldname" my $header_line = "fieldname" . <$fh>; # complete the line print "header: $header_line"; while( <$fh> ) # FIXME for testing { print " body: $_"; } #### header: fieldname1,fieldname2 body: value1,value2 body: more,body body: and,still body: more,body