#!/usr/bin/perl $hash_ref=set_up(); foreach $key (keys %{$hash_ref}) { $val=$$hash_ref{$key}; if (ref($val)) { print "\ntotal \'$key\' = ", scalar @{$hash_ref{$key}}, "\n"; foreach $act (@{$hash_ref{$key}}) { print "\t$act\n"; } } else { print "$key - $val\n"; } } sub set_up { my (%hash,@array); @array=("feed","walk","pet","groom"); $hash{'one'}="cat"; $hash{'two'}="dog"; push(@{$hash{'actions'}},@array); return(\%hash); }