$hash{$vars[2]} = join(' ', @vars[0,1,3]); #### foreach $var2 (keys %hash){ print "value: $hash{$var2}\n"; }