in reply to mapping two arrays into a hash
Update: This is the same as tachyon's code.my (%hash, @a, @b); %hash = map { ($a[$_], $b[$_]) } 0..$#a;
Although as always TMTOWTDI applies, and you can do it with other loops, although the one below is destructive:
my (%hash, @a, @b); $hash{shift @a} = shift @b while (@a and @b);
--
integral, resident of freenode's #perl
|
|---|