Uri Guttman wrote: > but what about mixing pairs and scalars which was the core of this > thread?
Then you get whatever behaviour you defined the hash to give. > by default it seems assigning such a list to a hash would use > the pairs as 2 elements It's not the right way to think about what happens. Pairs are always single elements. They don't "flatten" (unless you .kv them). Instead, the hash, upon encountering a pair, assigns the pair's value to the entry whose key is the pair's key. > (and how does that handle even/odd slot issues?). A pair in an even slot is probably an error and ought to be warned about at least. > declaring the hash as pairs makes it take them as pairs during > assignment. but what if you had a mix of them in an array and needed to > control the way they get assigned to a hash. Like I showed in the last post, if the default isn't doing what you want, you unpack 'em and iteratively assign 'em the way you want 'em. Not everything has to be easy. Only the easy things. ;-) > in some cases you want the array fully listified (maybe a .list method > on the array?) and in other cases you want any pairs to remain as single > elements be they key or pair (default behavior?). Pairs are *always* single elements. By default when a hash is initialized with one, it internally unpacks it. If you want anything else, you have to tell the hash to act (i.e. by keyed) differently. Or act (i.e. code) differently yourself. Damian