in reply to Re^2: How to get this not the usual round robin looping
in thread How to get this not the usual round robin looping

As already said in chat congratulation Athanasius for your Boustrophedon distribution function.I thought your crucial line was difficult to read and my hubris lead me think i could semplify it by playing with the index of @A..

..as always i endend with a hyper complicated and cryptic solution, even if my hubrys is partially satisfied: anyway TIMTOWTDI!!
#! perl use strict; use warnings; use Data::Dump; my @A = qw ( H1 H2 H3 H4); # original set my @B = qw (1 2 3 4 5 6 7 8 9 10); # as per OP my %h; my $i = 0; while (@B) { push @{$h{$A[$i]}},shift @B; $i == $#A ? $i = -1 : $i == -$#A-1 ? $i = 0 : $i < 0 ? $i-- : $i+ ++; } dd %h;


L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.