in reply to Returning two hashes from a sub?

Well, the way discussed in perlsub is simply to pass by reference.

That being the case, your snippet is pretty much how its done. Try not to get too hung up on the idea that your hash is known by reference rather than by name. There's really not much difference in how you write your code; you just dereference the references, that's all.

my ( $first, $second ) = routine(); print "$_\n" for keys %{$first}; print "$first->{Key1}\n"; # etc.....

If you start out using a reference to an anonymous hash, never naming your hash in the first place, you'll never need to worry about copying it back and forth between named hashes and referenced hashes.


Dave