my @line1 = ('_W9C2JJDCB','

This is the problem1.

','

This is res1

'); my @line2 = ('_W9C2JJDCB','

This is the problem2.

','

This is res2

'); my @line3 = ('_W9C2JJDCB','

This is the problem3.

','

This is res3

'); my @totlines; push (@totlines,\@line1); push (@totlines,\@line2); push (@totlines,\@line3); my @dir1 =('_W9C2JJDCB', '201200240', 'TEST: IGNORE', 'John Doe', 'Closed', 'HIP', 'email@email.com', 'email2@email.com', ); my %hash = ( '_W9C2JJDCB' => \@dir1); #At this point I have one hash (which may have many key/values) and one array which could have many array refs #### # So this is what I am trying to do for my $key(keys %hash) { my $value = $hash{$key}; my @arr = @$value; foreach my $u(@totlines) { if(@$u[0] == $key) { #print "$key @arr --- @$u\n"; push (@arr,@$u); $hash{$key} = \@arr; } } } print Dumper %ret;