in reply to Re: hashes
in thread Populating a hash with two arrays
This would be brain-dead only for Monks with a C background ;--)
A little more perlish would be a loop similar to broquaint's map:
my %hash; for my $i (0..$#people) { $hash{$people[$i]} = $jobs[$i]; }
If you don't care about emptying @jobs you can also do:
my %hash; foreach my people (@people) { $hash{$people}= shift @jobs; }
But really the hash slice is the most compact way to do it.
|
|---|