# Using hard references my @cat = (1,2,3); my @dog = (5,6); my @pig = (4,3,2,1); for my $array (\@cat, \@dog, \@pig) { # On first iteration $array will contain a reference to @cat. # On second iteration, $array will contain a reference to @dog. # On third iteration $array will contain a reference to @pig. } #### # Using a hash my %animals = ( cat => [1,2,3], dog => [5,6], pig => [4,3,2,1], ); for my $animal_type (keys %animals) { my @values = @{$animals{$animal_type}}; # Animals will come in an unpredictable order, but as an example: # First iteration, dog will be handled. # Second iteration, pig will be handled. # Third iteration, cat will be handled. }