My humble solution:
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;
UPDATE: ...or...
push @{ $hash{ $K[ int 3.5*abs sin (0.19634954085+0.39269908170*++$i) +] } }, $_ for @V;
In reply to Re: How to get this not the usual round robin looping
by hdb
in thread How to get this not the usual round robin looping
by fidda
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |