in reply to Creating the right type of array...

A slow-to-arrive answer: This here will print out the first field in the first occurrence of each of your six keys.
#!/usr/bin/perl open (SIX,"</home/adamsj/sixtext"); @lines = <SIX>; close(SIX); foreach (@lines) { chop; @a_line = split(/,/); $key = shift @a_line; push(@{$all_of_it{$key}},[@a_line]); } foreach (keys %all_of_it) { print "$all_of_it{$_}[0][0]\n";}
This should give you an idea how to do it--you could look in the Perl docs for more on this. I think the best treatment of references is in Advanced Perl Programming by Sriram Srinivasan (not that I have a copy--I used to borrow someone else's), but there are a lot of other good Perl books out there. This _is_ moderately advanced Perl--if you have trouble with this example, try working up to it with this:
foreach (@lines) { chop; ($key, $line) = split(/,/, $_, 2); push(@{$all_of_it{$key}},$line); } foreach (keys %all_of_it) { print "$key,$all_of_it{$_}[0]\n";}
What this does is split the line into the key and the remainder of the line, then puts the line into an array keyed by your, well, your key. It'll print out the entire line from the first occurence of each $key. Once you see how this one works, go for the more complex example. Good luck--I found this tricky at first, too.