foreach my $tmp (@a1){ push @a2, $h1{$tmp}; }