To answer the subject - you have a number of syntactical and semantic errors here.

First, you probably want () rather than {} on the @c and @d initialisation lines:

my @c = ( 22, 44, 55 ); my @d = ( 'yy', 'tt' ); # or my @d = qw(yy tt);
This will create a list rather than a reference to a hash.

Second, your assignments - an array, such as @b, can only hold scalars - not other arrays. That said, a reference to an array is a scalar. Thus, you probably want:

$b[0] = \@c; # hold a reference to @c. $b[1] = \@d;
However, once you do that, you need to dereference it when you want to copy it into @e.
my @e = @{$b[1]};
What you have right now creates arrays @c and @d, both of which contain a single element: a reference to a hash (again, a reference is a scalar of some type, thus can be in an array). Then you assign the "scalar" value of the array into $b[1] - the scalar value of an array is the length of the array (in this case, there's only one value in the array - the reference to the hash), and from there, you copy that 1 to @e as a single element.

Hope that helps.


In reply to Re: What do I do wrong? I want an array of arrays by Tanktalus
in thread What do I do wrong? I want an array of arrays by pcouderc

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.