in reply to Concise code to list array elements
Your sigil is wrong to take an array slice. You'll need something like:
my @role = ( [ qw(a b c d e f g h i j k l m) ], [ qw(n o p q r s t u v w x y z) ], ); my $row = 0; say $role[$row][1], $role[$row][2], $role[$row][3], $role[$row][4], $r +ole[$row][5], $role[$row][6], $role[$row][7], $role[$row][8], $role[$ +row][9], $role[$row][10]; say @{$role[$row]}[1..10];
Also, make sure that you really want to skip the first element of the row in your example. Array indexes start at 0, not 1.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Concise code to list array elements
by tel2 (Pilgrim) on Apr 08, 2013 at 04:18 UTC | |
by davido (Cardinal) on Apr 08, 2013 at 04:54 UTC | |
by tel2 (Pilgrim) on Apr 08, 2013 at 05:13 UTC |