in reply to Printing from three arrays
If you aren't doing anything else with them, just loop over the elements themselves instead of the indices. The innermost loop will loop most quickly, of course. So:
#!/usr/bin/env perl use strict; use warnings; my @array1 = (1, 2, 3); my @array2 = (qw/a b c/); # Enough to test my @array3 = (qw/I II III/); for my $alpha (@array2) { for my $roman (@array3) { for my $arabic (@array1) { print "$arabic,$alpha,$roman\n"; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Printing from three arrays
by daxim (Curate) on Sep 26, 2019 at 10:37 UTC |