in reply to Re: How to get this not the usual round robin looping
in thread How to get this not the usual round robin looping
Hello kcott,
This is good, but can be considerably simplified:
#! perl use strict; use warnings; use Data::Dump; my @A = qw{H1 H2 H3 H4 H5}; my @B = 1 .. 23; my %h; while (@B) { push @{ $h{$_} }, shift @B // () for @A, reverse @A; } dd \%h;
Output:
16:10 >perl 1404_SoPW.pl { H1 => [1, 10, 11, 20, 21], H2 => [2, 9, 12, 19, 22], H3 => [3, 8, 13, 18, 23], H4 => [4, 7, 14, 17], H5 => [5, 6, 15, 16], } 16:12 >
:-)
Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: How to get this not the usual round robin looping
by kcott (Archbishop) on Oct 13, 2015 at 06:45 UTC | |
Re^3: How to get this not the usual round robin looping [updated]
by choroba (Cardinal) on Oct 13, 2015 at 09:25 UTC | |
Re^3: How to get this not the usual round robin looping: Boustrophedon distribution
by Discipulus (Canon) on Oct 13, 2015 at 09:39 UTC | |
Re^3: How to get this not the usual round robin looping bustrophedon semplified
by Discipulus (Canon) on Oct 13, 2015 at 10:26 UTC | |
Re^3: How to get this not the usual round robin looping
by Anonymous Monk on Oct 13, 2015 at 06:56 UTC | |
by Athanasius (Archbishop) on Oct 13, 2015 at 07:15 UTC | |
by Anonymous Monk on Oct 13, 2015 at 07:30 UTC | |
by dsheroh (Monsignor) on Oct 13, 2015 at 07:07 UTC |