in reply to Returning multiple Hash references from a sub()
References are scalars. Assigning a (part of a) list to an array or hash puts all remaining scalars in that list into that array or hash, even if the left-hand side of the assignment has more than one variable.
Example: ($foo, @bar, @baz) = (1..10); results in $foo containing 1, @bar containing the list equivalent to (2..10), and @baz containing nothing (it was assigned an empty list, so any contents were overwritten).
Additionally, with warnings enabled, you would receive a warning about an odd (3) number of elements assigned to a hash, which requires an even number of elements (key-value pairs).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Returning multiple Hash references from a sub()
by moritz (Cardinal) on Sep 03, 2010 at 12:50 UTC |