my (%hash, @a, @b); %hash = map { ($a[$_], $b[$_]) } 0..$#a; #### my (%hash, @a, @b); $hash{shift @a} = shift @b while (@a and @b);