in reply to Re: Arrays in arrays, how to access them
in thread Arrays in arrays, how to access them

So you want to have a bunch of strings

So you want to stuff those strings under one thing, one bucket, one box, one variable

So you want to have an array-of-strings

So you have more than one array-of-strings

So keeping more than one array-of-strings in an array, seems natural

Unlesss, you want to name each and every one of those arrays of bunches of things, then keep them in a hash

#!/usr/bin/perl -- use strict; use warnings; my @feet = qw/ left right /; my @shoes = qw/ loafer sneaker boot /; my @lowers = ( \@feet, \@shoes ); ## $lower{feet} is prounounced lower-of-feet ## $lower{shoes} is prounounced lower-of-shoes my %lower = ( feet => [ @feet ], shoes => [ @shoes ] ); print "$lower{feet}[0] $lower{shoes}[0]\n"; print "$lower{feet}[1] $lower{shoes}[1]\n"; print "----\n"; for my $lower ( @lowers ){ for my $low ( @$lower ){ print " $low "; } print "\n"; } print "----\n"; ## while( my( $key, $value ) = each %lower ){ while( my( $lower, $of_array ) = each %lower ){ print "$lower $_\n" for @$of_array; }
foreach, each, Tutorials: Data Type: Array, references quick reference

More elaborate and coprehensive tutorial in http://learn.perl.org/books/beginning-perl/, Learn Perl in about 2 hours 30 minutes, perlintro, chromatics free book Modern Perl a loose description of how experienced and effective Perl 5 programmers work....You can learn this too.