while (defined (my $key = shift @keys) and defined(my $value = shift @values)) { $hash{$key} = $value; }