use strict; use warnings; use Data::Dumper; my %hash_of_hashes; while () { my %h; (my $rn, @h{ qw(lastname firstname DOB funding URNo Photo_permission) }) = (split /,/)[0,1,2,7,18,15,14]; $hash_of_hashes{$rn} = \%h; } foreach (keys %hash_of_hashes) { print $hash_of_hashes{$_},$/; } print "DATA DUMPER SAYS:\n", Dumper \%hash_of_hashes; __DATA__ a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp aaa,abb,acc,add,aee,aff,agg,ahh,aii,ajj,akk,all,amm,ann,aoo,app #### HASH(0x1824898) HASH(0x224fb4) HASH(0x224ef4) DATA DUMPER SAYS: $VAR1 = { 'a' => { 'URNo' => 'p ', 'firstname' => 'c', 'funding' => undef, 'DOB' => 'h', 'lastname' => 'b', 'Photo_permission' => 'o' }, 'aaa' => { 'URNo' => 'app ', 'firstname' => 'acc', 'funding' => undef, 'DOB' => 'ahh', 'lastname' => 'abb', 'Photo_permission' => 'aoo' }, 'aa' => { 'URNo' => 'pp ', 'firstname' => 'cc', 'funding' => undef, 'DOB' => 'hh', 'lastname' => 'bb', 'Photo_permission' => 'oo' } }; #### use strict; use warnings; use Data::Dumper; my %hash_of_hashes; my %h; while () { (my $rn, @h{ qw(lastname firstname DOB funding URNo Photo_permission) }) = (split /,/)[0,1,2,7,18,15,14]; $hash_of_hashes{$rn} = \%h; } foreach (keys %hash_of_hashes) { print $hash_of_hashes{$_},$/; } print "DATA DUMPER SAYS:\n", Dumper \%hash_of_hashes; __DATA__ a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp aaa,abb,acc,add,aee,aff,agg,ahh,aii,ajj,akk,all,amm,ann,aoo,app #### HASH(0x182485c) HASH(0x182485c) HASH(0x182485c) DATA DUMPER SAYS: $VAR1 = { 'a' => { 'URNo' => 'app ', 'firstname' => 'acc', 'funding' => undef, 'DOB' => 'ahh', 'lastname' => 'abb', 'Photo_permission' => 'aoo' }, 'aaa' => $VAR1->{'a'}, 'aa' => $VAR1->{'a'} }; #### use warnings; use Data::Dumper; my %hash_of_hashes; while () { %h=(); (my $rn, @h{ qw(lastname firstname DOB funding URNo Photo_permission) }) = (split /,/)[0,1,2,7,18,15,14]; $hash_of_hashes{$rn} = \%h; } foreach (keys %hash_of_hashes) { print $hash_of_hashes{$_},$/; } print "DATA DUMPER SAYS:\n", Dumper \%hash_of_hashes; __DATA__ a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp aaa,abb,acc,add,aee,aff,agg,ahh,aii,ajj,akk,all,amm,ann,aoo,app #### HASH(0x18248bc) HASH(0x18248bc) HASH(0x18248bc) DATA DUMPER SAYS: $VAR1 = { 'a' => { 'URNo' => 'app ', 'firstname' => 'acc', 'funding' => undef, 'DOB' => 'ahh', 'lastname' => 'abb', 'Photo_permission' => 'aoo' }, 'aaa' => $VAR1->{'a'}, 'aa' => $VAR1->{'a'} };