# 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;