in reply to return multiple hashes from a sub

Try dereferencing the hash references you get from your sub: foreach (keys %$hash1) { ... }.