This thread is getting a bit OT, but... >>> David <[EMAIL PROTECTED]> 01/10/05 12:36PM >>> On Mon, Jan 10, 2005 at 12:28:44PM -0500, [EMAIL PROTECTED] wrote:
Passing arguments explicitly by reference is only useful is you want to pass an array or hash as a single entity. HM>> I respectfully disagree :) It was already pointed out in this thread that the argument list gets flattened out, so hashes and arrays lose their identity when passed as any argument other than the first, since the receiving hash and array arguments in the subroutine can't know how many items belong to them and will swallow up the rest of the arguments. So IMHO the simple rule of thumb is to pass each and every argument as a scalar: * pass a scalar as itself (by value) * pass a reference to an array (which is a scalar) instead of the array itself * pass a reference to a hash (which is a scalar) instead of the hash itself this way each argument is a scalar and there are no hashes or arrays in the argument list to get flattened out. This is now probably as clear as mud ;-) Hardy Merrill