PUP-2894, the ability to assign multiple variables from an array was added. When using this to refactor typical code it became apparent that this is useful when there are only a few values to assign, or where there is a simple 1:1 map in a single place. Real world code typically need this feature to assign 10 (typical) but up to as many as 30-50 variables - with very high redundancy.
As it is difficult to writes arrays that merge, it is of great value to be able to assign multiple variables based on a hash.
The rules are:
- for each entry in the array, there must be a corresponding key in the hash
- the hash key must be based on the String variable name(s)
- if the hash does not have a corresponding key the operation fails
- there may be additional key/values in the hash
- if an element in the LHS array is an Array with multiple variables, the corresponding key in the hash must be an Array with the String names in the same order e.g.