my %h=(@$r); for (keys %h) { push @$r2, [$_, $h2{$_} ] } # or possibly # push @$r2, [$_, $h2{$_} ] for keys %h