my @foo = qw/1 2 3 4 5 6/; my @fu = qw/1 2 3 4 5 6/; my %bar = ( join ('',@foo) => 'elephants', join ('',@fu) => 'zebras' ); print Dumper \%bar;