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

Could you please post a 10 lines or so of your data. Also include the first line. Maybe we could better discern your problem.

Please edit your post, you need only make 1 change. Your closing code tag is <code>. That should be </code> with the forward slash.

It is impossible to read your code the way it is now.

Replies are listed 'Best First'.
Re^2: Obtaining header from file (first line) - printing to output file
by Anonymous Monk on Jul 16, 2012 at 23:10 UTC
    Sorry, I was vague on your problem. You want to print the forst line to a file, then do some additional processing. You could put the print statement in the section that tests for $x == 1. (You could have used the file line number variable, $. instead of $x. $. starts with 1 to the end.)
    if ($x==1) { print OUTFILE $line, "\n"; (@keys)=split(/\t/, $line); } else { my $y=0; (@holder) = split(/\t/, $line); my %hash; for my $column (@holder) {
      Thanks, Ill give it a try tomorrow and let you know how all goes!
        This worked perfectly. Appreciate the help!