my %temp; @temp{@a} = @b; while (my ($a_val, $b_val) = each %temp) { # Do stuff with $a_val and $b_val }