#This is with map as both arrays are of same length %hashofarray = map { $array1[$_] => $array2[$_] }0..$#array1; #This is a way to use arrays for building hash @hashofarray{@array1} = @array2;