Before Snip --- "SimpsonH","Homer","Simpson","NULL","648","0","218 555","Nuclear Control","Nuclear Operator","SimpsonM" "SimpsonH","Homer","Simpson","NULL","647","0","218 555","Nuclear Control","Nuclear Operator","SimpsonM" "SimpsonH","Homer","Simpson","NULL","648","0","218 555","Nuclear Control","Nuclear Operator","BurnsM" After Snip --- "SimpsonH","Homer","Simpson","NULL","648","0","218 555","Nuclear Control","Nuclear Operator","SimpsonM" #### #!/usr/bin/perl use strict; my %output_hash; while() { my ($id_field, @undef) = split /,/, $_; $output_hash{$id_field} = $_; } # Quickie Print print values %output_hash; # Or loop around it if there is more to be done: # foreach my $id_key (sort keys %output_hash) { # the more to be done stuff # print $output_hash{$id_key}; #} __DATA__ "SimpsonH","Homer","Simpson","NULL","648","0","218 555","Nuclear Control","Nuclear Operator","SimpsonM" "SimpsonH","Homer","Simpson","NULL","647","0","218 555","Nuclear Control","Nuclear Operator","SimpsonM" "SimpsonH","Homer","Simpson","NULL","648","0","218 555","Nuclear Control","Nuclear Operator","BurnsM" "SimpsonB","Bart","Simpson","NULL","748","0","218 555","Springfield Elementary","Student","SimpsonM" "SimpsonB","Bart","Simpson","NULL","748","0","218 555","Springfield Elementary","Student","SimpsonH" "SimpsonB","Bart","Simpson","NULL","748","1","218 555","Springfield Elementary","Student","SkinnerP"