You should start every perl program with:
use strict; use warnings;

The purpose is to help you solve you own problems. In this case, you will get several error messages. Some of them will not make any sense to you. Fix the easy ones and try again. You probably have fixed more than you thought. You may have also revealed a few more errors. Keep fixing errors a few at a time until it runs. If you really get stuck, ask for explanation of your remaining errors. Your current script probably will not run correctly even when it does run. You may have to ask for help again. It is much easier for the monks to find a fix you logic errors when they are not masked by other errors.

Another hint is to use meaningful variable names. Note the improvement in this solution.

use strict; use warnings; my @digits = qw(1 2 3); my @letters = qw(a b c d e f g); my @romans = qw(I II III); foreach my $letter (@letters) { foreach my $roman (@romans) { foreach my $digit (@digits) { print "$digit,$letter,$roman\n"; } } }
Bill

In reply to Re: Printing from three arrays by BillKSmith
in thread Printing from three arrays by oysterperl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.