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

Everyone has put in their ways, I'll put mine too for consideration... :)
#!/usr/bin/perl use strict; use warnings; my $str1 = "1,2,3"; my $str2 = "a,b,c"; my ($k, %hash, $i); $i = 0; my @keys = split /,/, $str1; my @values = split /,/, $str2; foreach $k (@keys){ $hash{$k} = $values[$i++]; } print %hash;

I leave it up to you to print the hash in the formatted way