Heading 1 Heading 2 Heading 3 ... Value A1 Value A2 Value A3 ... Value B1 Value B2 Value B3 ... . . . #### sub get_fields{ my $local_filein = shift; # Input file needs to be the first file passed to get_fields my %tmp_hash; my %tickets; my @keys; my @values; while(my $line = <$local_filein>){ chomp $line; if ($line =~ m/^\D/){ @keys = split(/\t/, $line); }elsif($line =~ m/d/){ @values = split(/\t/, $line); @tmp_hash{@keys} = @values; # foreach(keys %tmp_hash){ # print "KEY: $_ VALUE: $tmp_hash{$_}\n" # } $tickets { $values[0] } = %tmp_hash; #$tickets{ @values[0]{@keys}} = @values; #$tickets{ $values[0] } = { each %tmp_hash }; # Each is a piece of shit. Use @ context or something else. } } #@tickets{@keys} = @values; return %tickets; }