use strict; use warnings; use Data::Dumper; my @K = qw (H1 H2 H3 H4); my @V = qw (1 2 3 4 5 6 7 8 9 10); my %hash; my $i = -1; push @{ $hash{ $K[ ++$i&4 ? 3-$i%4 : $i%4 ] } }, $_ for @V; print Dumper \%hash; #### push @{ $hash{ $K[ int 3.5*abs sin (0.19634954085+0.39269908170*++$i) ] } }, $_ for @V;