|Perl: the Markov chain saw|
Re^2: Small troubles with referencesby injunjoel (Priest)
|on Feb 09, 2006 at 21:00 UTC||Need Help??|
Just to help illustrate how Perl 'flattens' or as I try to think of it (thanks to diotalevi) 'list-ifies' subroutine arguments consider the following
Notice in the output of the first call the keys and values from %hash get tacked onto the end of the values in @array as if the entire thing were one huge list. Now imagine trying to get keys or values from %hash? Not likely nor easy.
In the second and third examples we pass one reference but the argument list is still just a list.
The final example is much cleaner. If you were confused about what you originally passed into the sub your could always call ref and find out; otherwise there is no way to tell if you are passed a 'list-ified' hash or array.
"I do not feel obliged to believe that the same God who endowed us with sense, reason and intellect has intended us to forego their use." -Galileo