$goldcsv = @ARGV[0]; #$newcsv = @ARGV[1]; my %goldhash; my @keyarray; open GOLD, "$goldcsv"; my $i = 0; while () { chomp; $i=$i+1; if ($i eq 1) { @temparray = split (",",$_); my $j=0; foreach $elem (@temparray) { $j= $j+1; next if ($j eq 1); push (@keyarray, $elem); } next; } @temparray = split(",",$_); $testcasename = @temparray[0]; foreach my $value (1..$#temparray) { $goldhash{$testcasename}{$keyarray[$value-1]} = $temparray[$value]; } } for $testcase (keys %goldhash) { print "$testcase: "; for $value (keys %{ $goldhash{$testcase} }) { print "$value = $goldhash{$testcase}{$value} "; } print "\n"; }