in reply to Hashes of arrays problem

You can simplify your code without sacrificing clarity like this:

sub foo { my $hash_ref = shift; print "$_\n" for values %$hash_ref; }
If you want to use both keys and values, you still can do it with a single loop:
sub foo { my $hash_ref = shift; while ( my ( $key, $val ) = each %$hash_ref ) { # do something with $key and $val } }

the lowliest monk