in reply to Printing from three arrays

Hello oysterperl and welcome to the monastery and to the wonderful world of perl!

You start with @array1 but I think is better to cycle @array2 which seems governing your output.

use strict; use warnings; my @array1 = (1..5); my @array2 = ('a','b','c','d','e','f','g'); my @array3 = ('I', 'II', 'III'); foreach my $letter(@array2){ foreach my $index_roman(0..$#array3){ foreach my $index (0..$#array1){ print "$array1[$index],$letter,$array3[$index_roman]\n"; } } }

PS as wisely said by hippo, cycling indexes is no more needed, so semplified nested loop will be:

foreach my $letter(@array2){ foreach my $roman(@array3){ foreach my $number (@array1){ print "$number,$letter,$roman\n"; } } }

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.