in reply to can i return two hashes from a soubroutine

Subroutines can only return a scalar in scalar context.
Subroutines can only return a list of scalars in list context.
Subroutines can never return hashes or arrays.
That leaves you with two options:
1) Return information that will allow you to rebuild the hashes and arrays you wish to return, and/or
2) Return references to the hashes and arrays you wish to return.

This is very similar to arguments.
Only a list of scalars can be passed to a subroutine as arguments.
Hashes and arrays can never be passed to a subroutine as arguments.
You have the same two options in that situation:
1) Pass information that will allow you to rebuild the hashes and arrays you wish to provide, and/or
2) Pass references to the hashes and arrays you wish to provide.

  • Comment on Re: can i return two hashes from a soubroutine