Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: looking for a perl way to build a hash

by toolic (Chancellor)
on Jul 26, 2013 at 13:55 UTC ( #1046519=note: print w/ replies, xml ) Need Help??


in reply to looking for a perl way to build a hash

List::MoreUtils

use warnings; use strict; use List::MoreUtils qw(mesh); my $str1="a,b,c"; my $str2="1,2,3"; my @a1 = split /,/, $str1; my @a2 = split /,/, $str2; my %hash = mesh(@a1, @a2); use Data::Dumper; $Data::Dumper::Sortkeys=1; print Dumper(\%hash); __END__ $VAR1 = { 'a' => '1', 'b' => '2', 'c' => '3' };


Comment on Re: looking for a perl way to build a hash
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2014-07-14 05:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (255 votes), past polls