Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Creating a hash from arrays

by Eily (Chaplain)
on Nov 02, 2013 at 21:34 UTC ( #1060981=note: print w/ replies, xml ) Need Help??


in reply to Creating a hash from arrays

You could also use List::MoreUtils, either:

@keys = pairwise {return "$a $b"} @fname, @lname; @hash{@keys} = @state;
or
my $iter = each_array @fname, @lname, @state; while( ($firstName, $lastName, $state) = $iter->() ) { $hash{"$firstName $lastName"} = $state; }


Comment on Re: Creating a hash from arrays
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1060981]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (13)
As of 2014-11-24 14:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (141 votes), past polls