# write column for each fruit for my $i (0..$#fruits){ my $col = $i+2; my $fruit = $fruits[$i]; .. etc