#!/usr/bin/perl use strict; use warnings; my %pets; my $color; $color="black"; $pets{$color}=\[]; push @${$pets{$color}},"cat"; push @${$pets{$color}},"dog"; $color="while"; $pets{$color}=\[]; push @${$pets{$color}},"rat"; push @${$pets{$color}},"bat"; foreach my $p (values %pets) { print "$p\n"; #^^^this is ref to ref to array? print "$$p\n"; #^^^this is ref to array print "@$$p\n\n"; #^^^this is array }