in reply to What do I do wrong? I want an array of arrays

{ } is an anonymous hash reference constructor, which are you attempting to assign to the arrays @c and @d. @c and @d are arrays, which are you trying to assign to the scalar array elements $b[0] and $b[1].

I don't know exactly what you're trying to do, but I would guess you want something like this.

my @c = ( 22, 44, 55 ); my @d = ( 'yy', 'tt' ); my @b; @b[0,1] = ( $c[0], $d[0] ); my @e = ( $b[1] ); print "<$e[0]>\n";

Replies are listed 'Best First'.
Re^2: What do I do wrong? I want an array of arrays
by pcouderc (Monk) on Sep 27, 2005 at 18:45 UTC
    Mmm, yes, I should better explain what I am wanting to do. I want to get an array of arrays of variable size of strings. I have "blocks" of lines of text and i want to manipulate them. So I want to store 'yy' in the first line of my second block then get it back.