See perldsc. (Update: And also Slices in perldata.)c:\@Work\Perl\monks>perl -wMstrict -le "my @shapes = ( [qw/circle square triangle polygon/], [qw/red green blue yellow fuschia/], [qw/a b c d e f g h i j k/] , [qw/Movie TV Radio/] , ); ;; for my $arrayref (@shapes) { printf qq{'$_' } for @{$arrayref}[ 2 .. $#$arrayref ]; print ''; } " 'triangle' 'polygon' 'blue' 'yellow' 'fuschia' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'Radio'
Update: Or if you don't want to use a slice, maybe
c:\@Work\Perl\monks>perl -wMstrict -le "my @shapes = ( [qw/circle square triangle polygon/], [qw/red green blue yellow fuschia/], [qw/a b c d e f g h i j k/] , [qw/Movie TV Radio/] , ); ;; for my $arrayref (@shapes) { printf qq{'$arrayref->[$_]' } for 2 .. $#$arrayref; print ''; } " 'triangle' 'polygon' 'blue' 'yellow' 'fuschia' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'Radio'
Give a man a fish: <%-{-{-{-<
In reply to Re: How do I access only certain elements of a multidimensional array?
by AnomalousMonk
in thread How do I access only certain elements of a multidimensional array?
by Ppeoc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |