@hash{@keys} = @values

beckheng on 2007-02-25T14:29:20

this is equal to
$hash{$keys[0]} = $values[0];
.
.
.
$hash{$keys[n]} = $values[n];


Althought that glosses over what happens...

merlyn on 2007-02-25T17:56:55

When @keys and @values are unequal lengths.

Yep

jdavidb on 2007-02-26T04:32:10

But I'm more likely to use the reverse:

my @values = @hash{@keys};

You can fabricate values from the keys

Ron Savage on 2007-02-26T09:00:23

@hash{@keys} = (1) x @keys;

This is a neat way to turn an array into hash keys.

Re:You can fabricate values from the keys

Aristotle on 2007-02-26T19:42:31

undef @hash{@keys};