Most of us have interpreted the goal like this

Yes, I noticed. It would have been silly to post something that was already posted.

There's no rule that says that the first dimension must be rows and the second must be columns. Here code that shows my solution does indeed use @array1 as the first column and @array2 as the second column.

my @array1 = qw( a b c ); my @array2 = qw( X Y Z ); my @matrix = (\@array1, \@array2); for my $row (0..$#{$matrix[0]}) { for my $col (0..$#matrix) { print $matrix[$col][$row], "\t"; } print "\n"; }
a X b Y c Z

Update: Added code.


In reply to Re^3: Creating two dimensional array by ikegami
in thread Creating two dimensional array by Anonymous Monk

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.