Hmm, not quite. In fact, not at all. $; controls the symbol used as a subscript seperator for multi-dimensional hashes, not arrays. Perl arrays are more like lists - they are dynamiclly sized and can not by managed in the same way that fixed size C arrays can be.

To achieve multi-dimensional arrays in Perl you need to remember that a scalar can hold a reference to another object, for our purposes it can hold a reference to an array. So we implement multi-dimensional arrays by having an array of references to arrays.

A little syntactic sugar makes accessing such multi-dimensional arrays identical with the equivelent C syntax. $AoA[0][0] accesses the first element in the first row of the array @AoA. @AoA is really an array of references to arrays. The syntactic sugar saves writing the access as $AoA[0]->[0]; to dereference the first element of @AoA then index into the array referenced by that element. Take a look at the two @xxxx_cps arrays in the code sample in Re: print arrays a(i), b(i,j) c(i,j) to see how they are initialised and how elements in them are accessed


DWIM is Perl's answer to Gödel

In reply to Re^2: print arrays a(i), b(i,j) c(i,j) by GrandFather
in thread print arrays a(i), b(i,j) c(i,j) by pattobw

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.