http://www.perlmonks.org?node_id=1046520


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

use strict; use warnings; use Data::Dumper; use List::MoreUtils qw(mesh); my $str1="a,b,c"; my $str2="1,2,3"; my %hash = mesh @{[ split/,/,$str1 ]}, @{[ split/,/,$str2 ]}; print Dumper \%hash;