sub foo (){ my $hash_ref = shift; foreach my $key (keys %$hash_ref){ foreach my $val(@${$$hash_ref{$key}}){ print $val . "\n"; } } }