oysterperl has asked for the wisdom of the Perl Monks concerning the following question:
I am trying the following but its not able to loop correctly.1,a,I 2,a,I 3,a,I 4,a,I 5,a,I 1,a,II 2,a,II 3,a,II 4,a,II 5,a,II 1,a,III 2,a,III 3,a,III 4,a,III 5,a,III 1,b,I 2,b,I 3,b,I 4,b,I 5,b,I 1,b,II 2,b,II 3,b,II 4,b,II 5,b,II 1,b,III 2,b,III 3,b,III 4,b,III 5,b,III and so on.
How can I fix this? Thanks in advance for your help.my $i = $j = $k = 0; for my $i (@array1) { for my $j (@array2) { for my $k (@array3) { print "$array1[k],$array2[j],$array3[i],\n"; $k++; } $j++; } $k++; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Printing from three arrays
by hippo (Archbishop) on Sep 26, 2019 at 08:49 UTC | |
by daxim (Curate) on Sep 26, 2019 at 10:37 UTC | |
Re: Printing from three arrays
by Discipulus (Canon) on Sep 26, 2019 at 08:55 UTC | |
Re: Printing from three arrays
by johngg (Canon) on Sep 26, 2019 at 14:29 UTC | |
by AnomalousMonk (Archbishop) on Sep 26, 2019 at 18:20 UTC | |
by FreeBeerReekingMonk (Deacon) on Sep 26, 2019 at 22:09 UTC | |
by AnomalousMonk (Archbishop) on Sep 26, 2019 at 23:36 UTC | |
Re: Printing from three arrays
by BillKSmith (Monsignor) on Sep 26, 2019 at 22:47 UTC | |
Re: Printing from three arrays
by FreeBeerReekingMonk (Deacon) on Sep 26, 2019 at 21:06 UTC | |
Re: Printing from three arrays
by oysterperl (Novice) on Sep 30, 2019 at 06:52 UTC |