in reply to Obtaining header from file (first line) - printing to output file

It isn't entirely clear to me what you are asking; however, I'm assuming that your input file has column headers that you want to keep for your output file, but you want to strip them off the input file before processing it. Is this correct? If so, you were sort of on the right track with the code you commented out towards the beginning:
#head -1 <IN>; #my $firstline = IN;

Try changing this to the following and see if it does what you want:

my $header = <IN>; print OUTFILE $header;

Of course, be sure to open your OUTFILE file handle before writing.